Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Vehicles Car_Script_Front_Wheel  

Car_Script_Front_Wheel

Car Script (Front Wheel).lsl

Category: Vehicles
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Car_Script_Front_Wheel
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Car_Script_Front_Wheel_1.lsl
1
2 rotation Inverse(rotation r)
3 {
4 r.x = -r.x;
5 r.y = -r.y;
6 r.z = -r.z;
7 return r;
8 }
9 rotation GetParentRot()
10 {
11 return Inverse(llGetLocalRot())*llGetRot();
12 }
13 SetLocalRot(rotation x)
14 {
15 llSetRot(x*Inverse(GetParentRot()));
16 }
17
18 default
19 {
21 {
22 }
23
24 link_message(integer sender_num, integer num, string str, key id)
25 {
26 if(str == "WHEEL_DRIVING")
27 {
28 state driving;
29 }
30 }
31
32 }
33
34 state driving
35 {
37 {
38 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
39 llSetTimerEvent(0.5);
40 }
41
42 timer()
43 {
44 vector vel = llGetVel();
45 float speed = llVecMag(vel);
47 }
48
49 link_message(integer sender_num, integer num, string str, key id)
50 {
51 if(str == "WHEEL_DEFAULT")
52 {
53 state default;
54 }
55
56 if(str == "WHEEL_FORWARD")
57 {
58 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
59 }
60
61 if(str == "WHEEL_REVERSE")
62 {
63 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
64 }
65
66 if(str == "WHEEL_LEFT")
67 {
68 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO, -1 * PI_BY_TWO / 2, 0> ));
69 }
70
71 if(str == "WHEEL_RIGHT")
72 {
73 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO, PI_BY_TWO / 2, 0> ));
74 }
75
76 }
77
79 {
80 SetLocalRot(llEuler2Rot(<-1 * PI_BY_TWO,0,0> ));
81 llSetTextureAnim(0,ALL_SIDES,0,0,0,0,0);
82 }
83
84 }
85 // END //

Back to the Best Free Tools in Second Life and OpenSim.