inclinedplanecontrolscripts

=**Inclined Plane control scripts**= These scripts are for the 4 control prims. They should all be linked to the root prim (the inclined plane). Wherever you place them, the scripts should keep them in the same relative location as the inclined plane's size is adjusted.

Return to the 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.
 * Drop**

// Drop - Rez the ball and watch it roll - place inside linked prim to activate trajectory listen //v0.4.1 default {   touch_start(integer total_number) {       if (llDetectedKey(0) == llGetOwner) llMessageLinked(LINK_ROOT, 0, "Drop", NULL_KEY); }    link_message( integer sender_num, integer num, string str, key id ) {       if (num == 1) {           float adjXby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos - ); }       if (num == 2) {           float adjZby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos + <0,0,adjZby>); }   } } code

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.
 * Set X** (base length)

// Get X - length of base of inclined plane - place inside linked prim to activate trajectory listen //v0.4.1 default {   touch_start(integer total_number) {       if (llDetectedKey(0) == llGetOwner) llMessageLinked(LINK_ROOT, 0, "X", NULL_KEY); }

link_message( integer sender_num, integer num, string str, key id ) {        if (num == 1) {           float adjXby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos - ); }       if (num == 2) {           float adjZby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos + <0,0,adjZby>); }   } }

code

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.
 * Set Z** (height)

// Get Z - Height of inclined plane - place inside linked prim to activate trajectory listen //v0.4.1 default {   touch_start(integer total_number) {       if (llDetectedKey(0) == llGetOwner) llMessageLinked(LINK_ROOT, 0, "Z", NULL_KEY); }   link_message( integer sender_num, integer num, string str, key id ) {        if (num == 1) {           float adjXby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos - ); }       if (num == 2) {           float adjZby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos + <0,0,adjZby>); }   } } code

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.
 * Set Angle** - note the angle in question here is the angle at the end of the inclined plane/ramp such that the tangent of this angle is the height/base length.

// Get theta - Angle of inclined plane - place inside linked prim to activate trajectory listen //v0.4.1

default {   touch_start(integer total_number) {       if (llDetectedKey(0) == llGetOwner)

llMessageLinked(LINK_ROOT, 0, "Angle", NULL_KEY);

}   link_message( integer sender_num, integer num, string str, key id ) {        if (num == 1) {           float adjXby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos - ); }       if (num == 2) {           float adjZby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos + <0,0,adjZby>); }   } }

code =Catcher Script= This script simply keeps whatever you place at the end of the ramp to help contain the ball so that it doesn't roll all over your sim. 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.

// Moves to the end of the ramp to catch the ball //v0.4.1

default {   link_message( integer sender_num, integer num, string str, key id ) {        if (num == 1) {           float adjXby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos - ); }       if (num == 2) {           float adjZby = (float)str; vector myPos = llGetLocalPos; llSetPos(myPos + <0,0,adjZby>); }   } }

code