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 Helicopter  

Helicopter

Helicopter

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

the Zip file

Download all files for Helicopter
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Helicopter_1.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15 float forward_power = 15; //Power used to go forward (1 to 30)
16 float reverse_power = -15; //Power ued to go reverse (-1 to -30)
17 float turning_ratio = 2.0; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)
18 string sit_message = "Ride"; //Sit message
19 string not_owner_message = "You are not the owner of this vehicle ..."; //Not owner message
20 float VERTICAL_THRUST = 7;
21 float ROTATION_RATE = 2.0; // Rate of turning
22
23 resetY()
24 {
25 rotation rot = llGetRot();
26 llSetRot(rot);
27 }
28
29 default
30 {
32 {
33 llSetSitText(sit_message);
34 // forward-back,left-right,updown
35 llSitTarget(<0.2,0,0.45>, ZERO_ROTATION );
36
37 llSetCameraEyeOffset(<-8, 0.0, 5.0>);
38 llSetCameraAtOffset(<1.0, 0.0, 2.0>);
39
40 llPreloadSound("helicopter_run");
41
42 //car
44
49
50 llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 0.2);
53 llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.1);
54
57
59
62
66
67
68 }
69
70 changed(integer change)
71 {
72
73
74 if(change & CHANGED_LINK)
75 {
76
77 key agent = llAvatarOnSitTarget();
78 if(agent)
79 {
80 if(agent != llGetOwner())
81 {
82 llSay(0, not_owner_message);
83 llUnSit(agent);
84 llPushObject(agent, <0,0,50>, ZERO_VECTOR, FALSE);
85 }
86 else
87 {
89
90 llSleep(.4);
92 llSetStatus(STATUS_ROTATE_Y,TRUE);
93 llSleep(.1);
95
96 llLoopSound("helicopter_run",1);
97 }
98 }
99 else
100 {
103
105 llSleep(.4);
107 llTargetOmega(<0,0,0>,PI,0);
108
110 }
111 }
112
113 }
114
116 {
117 if(perm) {
119 }
120 }
121
122 control(key id, integer level, integer edge)
123 {
124 vector angular_motor;
125
126
127 // going forward, or stop going forward
128 if(level & CONTROL_FWD)
129 {
131 } else if(edge & CONTROL_FWD)
132 {
134 }
135
136
137 // going back, or stop going back
138 if(level & CONTROL_BACK)
139 {
141 }
142 else if(edge & CONTROL_BACK)
143 {
145 }
146
147 // turning
149 {
150 angular_motor.x += 25;
151 }
152
154 {
155 angular_motor.x -= 25;
156 }
157
158
159 // going up or stop going up
160 if(level & CONTROL_UP) {
162 } else if(edge & CONTROL_UP) {
164 }
165
166 // going down or stop going down
167
168 if(level & CONTROL_DOWN) {
170 } else if(edge & CONTROL_DOWN) {
172 }
173
174 angular_motor.y = 0;
176
177
178
179 } //end control
180
181
182
183 } //end default

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