InclinedPlaneBallScript

=Inclined Plane Ball and Tracer Scripts= This script should be placed inside of a sphere that is set as physical and named "Ball". In addition, the scripted tracer prim is placed inside the Ball prim. This Ball prim is placed inside of the root prim of the Inclined Plane.

Return to main Inclined Plane page

code format="lsl2" //Written by Jeff Mao //Distributed under a Creative Commons Attribution 3.0 license [CC-BY](http://creativecommons.org/licenses/by/3.0/) //If you have questions about this, please feel free to contact me at jmao@mac.com. //Please share alterations, improvements, lesson plans related to this simulation, etc.
 * Ball script**

//v0.1 - prototype //v0.2.1 - bug fix for SL vs Opensim

//details for tracer rounds string object = "tracer"; // Name of object in inventory vector relativePosOffset = <0.0, 0.0, 0.0>; vector relativeVel = <0.0, 0.0, 0.0>; rotation relativeRot = <0.0, 0.0, 0.0, 0.0>; integer startParam = 10;

//details for counter for tracer rounds float gap = .5; //tracer round every ___ seconds integer tracercount = 0; integer tracermax = 5; //number of tracers (+1 since count starts at 0)

default {

on_rez(integer start_param) {       float time = llGetTimeOfDay; vector startPos = llGetPos; string mydata = "x"+(string)startPos.x +"y"+(string)startPos.y +"z"+(string)startPos.z +"t"+ (string)time; llSetObjectName(mydata); llSetTimerEvent(gap); }

timer {       ++tracercount; vector myPos = llGetPos; rotation myRot = llGetRot;

vector rezPos = myPos+relativePosOffset*myRot; vector rezVel = relativeVel*myRot; rotation rezRot = relativeRot*myRot;

llRezAtRoot(object, rezPos, rezVel, rezRot, startParam);

if (tracercount > tracermax) {       llSetTimerEvent(0); }   }    touch_start(integer num_detected) {       llSay(0,""); llSetTimerEvent(0); state done; } } state done {   state_entry {       llSetTimerEvent(0); llSetStatus( STATUS_PHYSICS, FALSE ); }   touch_start(integer num_detected) {       llSetStatus( STATUS_PHYSICS, FALSE ); llSay(0,""); } }

code