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
Vehicle OpenSim Scooter  

OpenSim Scooter

An Opensim Scooter

Category: Vehicle
By : Various
Created: 2014-07-15 Edited: 2014-07-15
Worlds: Second Life

the Zip file

Download all files for OpenSim Scooter
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.lsl
1 //Final code and animations and sounds by Christy Lock OSGRID 4/23/2014
2 //Maegan OMally standalone alt may be listed also
3
4 //Special Thanks to Robert Adams and all those who worked on BulletSim!
5 //BulletSim Required for this to work
6 //Thanks to Cory and ANdrew Linden as their work and instructions contributed to this code
7
8 //EVERYTHING in the scooter is opensource free to use as you like
9
10
11 key agent;
12 key sittingAlready;//this is needed to stop the passenger from shuting down the scooter in the changed event
13 key passenger;
14
15 integer handle;
16
17 float forward_power = 35.0; //Power used to go forward
18 float reverse_power = -25.0; //Power ued to go reverse
19 float turn_rate = 15.0;//rotation (twist) around angular.z
20
21 string sit_message = "Scoot"; //Sit message
22
23 vector linear;
24 vector angular;
25
26 float xfactor = 28.0;//Normal velocity all three axis
27 float yfactor = 8.0;
28 float zfactor = 12.0;
29
30 dialog(key user)
31 {
32 handle = llListen(-2,"",user,"");
33 llDialog(user,"Options",["normal","slow"],-2);
34 }
35
36 cam()
37 {
38 //extra camera code for testing
40 CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
41 CAMERA_BEHINDNESS_ANGLE, 95.0, // (0 to 180) degrees
42 CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
43 CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
44 //CAMERA_FOCUS, <0,0,5>, // region relative position
45 CAMERA_FOCUS_LAG, 0.1 , // (0 to 3) seconds
46 CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
47 CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
48 PITCH" title="View Definition" class="tooltip">CAMERA_PITCH, 20.0, // (-45 to 80) degrees
49 //CAMERA_POSITION, <0,0,0>, // region relative position
50 CAMERA_POSITION_LAG, 0.1, // (0 to 3) seconds
51 CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
52 CAMERA_POSITION_THRESHOLD, 2.0, // (0 to 4) meters
53 CAMERA_FOCUS_OFFSET, <0.0,0.0,0.0> // <-10,-10,-10> to <10,10,10> meters
54 ]);
55 }
56 camfixed()
57 {
58 //actual camera used....Camera_Position_Lag should be 0.0 0.1 makes the cam bump a little
59 //and look like the physics engine is on off on off - same for Camera_behindness_lag
61 CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
62 CAMERA_BEHINDNESS_ANGLE, 95.0, // (0 to 180) degrees
63 CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
64 CAMERA_DISTANCE, 7.0, // ( 0.5 to 10) meters
65 //CAMERA_FOCUS, <0,0,5>, // region relative position
66 CAMERA_FOCUS_LAG, 0.0 , // (0 to 3) seconds
67 CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
68 CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
69 PITCH" title="View Definition" class="tooltip">CAMERA_PITCH, 20.0, // (-45 to 80) degrees
70 //CAMERA_POSITION, <0,0,0>, // region relative position
71 CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
72 CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
73 CAMERA_POSITION_THRESHOLD, 2.0, // (0 to 4) meters
74 CAMERA_FOCUS_OFFSET, <0.0,0.0,0.0> // <-10,-10,-10> to <10,10,10> meters
75 ]);
76 }
77 driving_cam360()
78 {
79 //extra camera code for testing
81 CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
82 CAMERA_BEHINDNESS_ANGLE, 180.0, // (0 to 180) degrees
83 CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
84 CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
85 //CAMERA_FOCUS, <0,0,5>, // region relative position
86 CAMERA_FOCUS_LAG, 0.1 , // (0 to 3) seconds
87 CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
88 CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
89 PITCH" title="View Definition" class="tooltip">CAMERA_PITCH, 20.0, // (-45 to 80) degrees
90 //CAMERA_POSITION, <0,0,0>, // region relative position
91 CAMERA_POSITION_LAG, 0.1, // (0 to 3) seconds
92 CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
93 CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
94 CAMERA_FOCUS_OFFSET, <0,0,-2.0> // <-10,-10,-10> to <10,10,10> meters
95 ]);
96 }
97 driving_cam90()
98 {
99 //extra camera code for testing
101 CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
102 CAMERA_BEHINDNESS_ANGLE, 95.0, // (0 to 180) degrees
103 CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
104 CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
105 //CAMERA_FOCUS, <0,0,5>, // region relative position
106 CAMERA_FOCUS_LAG, 0.1 , // (0 to 3) seconds
107 CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
108 CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
109 PITCH" title="View Definition" class="tooltip">CAMERA_PITCH, 20.0, // (-45 to 80) degrees
110 //CAMERA_POSITION, <0,0,0>, // region relative position
111 CAMERA_POSITION_LAG, 0.1, // (0 to 3) seconds
112 CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
113 CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
114 CAMERA_FOCUS_OFFSET, <0,0,0> // <-10,-10,-10> to <10,10,10> meters
115 ]);
116 }
117
118 init()
119 {
120 llPreloadSound("jetstartupfinal");
121 llPreloadSound("jetloopfinal");
122 llPreloadSound("jetshutdownfinal");
123
125
126 //ANGULAR MOTOR **
127 // somewhat responsive angular motor, but with 3 second decay timescale
129 llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 3);
130
131 // weak angular deflection
134
135 //weak friction all 3 axis
137
138 ;
139
140 //* LINEAR MOTOR **
141 llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);//0.5
143
144 //moderate - weakish linear deflection
147
148 //weak friction for linear motor also
150
151
152
153
154 //** VERTICAL ATTRACTOR **
157
158 //** BANKING STRENGTH and MIX for speed
159 llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, 0.4);//0.4 // medium strength
160 llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.8);//0.1//0.8 // very responsive
161 llSetVehicleFloatParam(VEHICLE_BANKING_MIX, 0.95);//0.95 // more banking when moving
162
163
164 //** 1.0 floats and turn on physics **
167
168 }
169
170 release_camera_control()
171 {
172 llSetCameraParams([CAMERA_ACTIVE, 0]); // 1 is active, 0 is inactive
173 }
174
175 default
176 {
178 {
179 llMessageLinked(LINK_SET,-1,"Tstop","");//stop particles and turbine spin
180 llSetSitText(sit_message);
181 llSitTarget(<-0.02,0.0,-0.15>, ZERO_ROTATION );
184 }
185 touch_start(integer touched)
186 {
187 key avatar = llDetectedKey(0);
188 dialog(avatar);
189 }
190 listen(integer chan,string name,key id , string msg)
191 {
192 if( msg == "normal")
193 {
194 llOwnerSay( "Normal speed");
195 xfactor = 28.0;
196 yfactor = 8.0;
197 zfactor = 12.0;
198 llListenRemove(handle);
199 }
200 else if( msg == "slow")
201 {
202 llOwnerSay( "Slow speed");
203 xfactor = 10.0;
204 yfactor = 4.0;
205 zfactor = 4.0;
206 llListenRemove(handle);
207 }
208 }
209 changed(integer change)
210 {
211 if(change & CHANGED_LINK)
212 {
213 agent = llAvatarOnSitTarget();
214
215 if(agent != NULL_KEY)
216 {
218 llStartAnimation("Moto6 p4 loop");
219
220 llTriggerSound("jetstartupfinal",1.0);
221 llLoopSound("jetloopfinal",1.0);
222
223 init();
224 camfixed();
225 llMessageLinked(LINK_SET,-1,"Tstart","");
226 }
227 else
228 {
229 llMessageLinked(LINK_SET,-1,"Tstop","");
230 llTriggerSound("jetshutdownfinal",1.0);
231 llSleep(0.2);
232 release_camera_control();
235 }
236 }
237 }
239 {
240 if(perm)
241 {
243
244 }
245 }
246
247 control(key name, integer levels, integer edges)
248 {
249 if((edges & levels & CONTROL_UP))
250 {
251 linear.z += zfactor;
252 }
253 else if((edges & ~levels & CONTROL_UP))
254 {
255 linear.z -= zfactor;
256 }
257 if((edges & levels & CONTROL_DOWN))
258 {
259 linear.z -= zfactor;
260 }
261 else if((edges & ~levels & CONTROL_DOWN))
262 {
263 linear.z += zfactor;
264 }
265 if((edges & levels & CONTROL_FWD))
266 {
267 linear.x += xfactor;
268 }
269 else if((edges & ~levels & CONTROL_FWD))
270 {
271 linear.x -= xfactor;
272 }
273 if((edges & levels & CONTROL_BACK))
274 {
275 linear.x -= xfactor;
276 }
277 else if((edges & ~levels & CONTROL_BACK))
278 {
279 linear.x += xfactor;
280 }
281
282 if((edges & levels & CONTROL_LEFT))
283 {
284 linear.y += yfactor;
285 llStartAnimation("Moto6_left_Remake1 p4 nl");
286 }
287 else if((edges & ~levels & CONTROL_LEFT))
288 {
289 linear.y -= yfactor;
290 }
291 if((edges & levels & CONTROL_RIGHT))
292 {
293 linear.y -= yfactor;
294 llStartAnimation("Moto6_right_Remake1 p4 nl");
295 }
296 else if((edges & ~levels & CONTROL_RIGHT))
297 {
298 linear.y += yfactor;
299 }
300 if((edges & levels & CONTROL_ROT_LEFT))
301 {
302
303 angular.z += turn_rate;
304 angular.x -= PI * 3;
305 llStartAnimation("Moto6_left_Remake1 p4 nl");
306 }
307 else if((edges & ~levels & CONTROL_ROT_LEFT))
308 {
309 angular.z -= turn_rate;
310 angular.x += PI * 3;
311 }
312 if((edges & levels & CONTROL_ROT_RIGHT))
313 {
314 angular.z -= turn_rate;
315 angular.x += PI * 3;
316 llStartAnimation("Moto6_right_Remake1 p4 nl");
317 }
318 else if((edges & ~levels & CONTROL_ROT_RIGHT))
319 {
320 angular.z += turn_rate;
321 angular.x -= PI * 3;
322 }
325 }
326 }

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