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
Collider Fence_collision_script  

Fence_collision_script

Fence_collision_script

Category: Collider
By : fred.beckhusen
Created: 2011-07-19 Edited: 2011-07-19
Worlds: Second Life

the Zip file

Download all files for Fence_collision_script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Fence_collision_script_1.lsl
1
2 // start of code - this next line may need modifications
3
4 vector PUSH = <0,50,0>;
5 // bigger numbers make it fall over and further away. How much push to use depends upon how massive your fence is
6 // you can push on more than 1 axis, such as <50,50,0>
7 // negative numbers will 'pull'
8 // <0,50,0> pushes in the Y axis < X ,Y, Z>. <0,-50,0> will pull in the Y axis.
9 // you may have to change this to <50,0,0> or even <0,0,50> depending upon how your object is rotated
10 // if you set this to <0,0,0> it will not fall over except by gravity and any force from the collision itself
11
12 // these two variable are located outside the 'default' so that all events can set and read them
13 vector myPos; // place to store the initial position
14 rotation myRot; // place to store the initial rotation
15
16
17 default
18 {
19
21 {
22 llSetStatus(STATUS_PHYSICS, FALSE); // make it Non-physical when you rez it
23 myPos = llGetPos(); // save the initial position and rotation so we can set it back upright when reset
24 myRot = llGetRot();
25 }
26
27 // when something collides, this collision start will trigger
29 {
30 llSetStatus(STATUS_PHYSICS, TRUE); // make it physical
31 llSleep(0.1); // give time for the physics engine to kick in.
32 llPushObject(llGetKey(), PUSH, PUSH, TRUE); // push it over
33 }
34
35 // no more collisions
37 {
38 llSetTimerEvent( 10 ); // wait 10 seconds to tilt back up after no more collisions happen
39 }
40
41 // 10 seconds is up
42 timer()
43 {
44 llSetStatus(STATUS_PHYSICS, FALSE); // make it Non-physical
45 llSleep(0.1); // give time for the physics engine to kick off.
46 llSetPos(myPos); // stand it back upright
47 llSetRot(myRot); // at the original rotation
48 }
49
50
51 on_rez(integer start_p)
52 {
54 }
55 }

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