Join us in Phaze Demesnes

LSL Script Library Home   Add a script Show All
Category: Contributor: Description
Vehicles Anonymous Car Script (Front Wheel).lsl
Car Script (Front Wheel).lsl
Car Script (Front Wheel).lsl

Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.

1 // CATEGORY:Vehicles
2 // DESCRIPTION:Car Script (Front Wheel).lsl
3 // ARCHIVED BY:Ferd Frederix
4
6 {
7 r.x = -r.x;
8 r.y = -r.y;
9 r.z = -r.z;
10 return r;
11 }
12 rotation GetParentRot()
13 {
14 return Inverse(llGetLocalRot())*llGetRot();
15 }
16 SetLocalRot(rotation x)
17 {
18 llSetRot(x*Inverse(GetParentRot()));
19 }
20
21 default
22 {
24 {
25 }
26
28 {
29 if(str == "WHEEL_DRIVING")
30 {
31 state driving;
32 }
33 }
34
35 }
36
37 state driving
38 {
40 {
41 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
42 llSetTimerEvent(0.5);
43 }
44
45 timer()
46 {
47 vector vel = llGetVel();
48 float speed = llVecMag(vel);
49 llSetTextureAnim(ANIM_ON|LOOP|SMOOTH|ROTATE,ALL_SIDES,0,0,0,0,speed);
50 }
51
53 {
54 if(str == "WHEEL_DEFAULT")
55 {
56 state default;
57 }
58
59 if(str == "WHEEL_FORWARD")
60 {
61 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
62 }
63
64 if(str == "WHEEL_REVERSE")
65 {
66 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
67 }
68
69 if(str == "WHEEL_LEFT")
70 {
71 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO, -1 * PI_BY_TWO / 2, 0> ));
72 }
73
74 if(str == "WHEEL_RIGHT")
75 {
76 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO, PI_BY_TWO / 2, 0> ));
77 }
78
79 }
80
82 {
83 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
84 llSetTextureAnim(0,ALL_SIDES,0,0,0,0,0);
85 }
86
87 }
88 // END //