Created
March 22, 2015 10:53
-
-
Save neojou/f9e5255c65c3e5976006 to your computer and use it in GitHub Desktop.
second life : LSL : make ball bounce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default | |
{ | |
on_rez(integer arg) | |
{ | |
llResetScript(); | |
llSetStatus(STATUS_PHYSICS, TRUE); | |
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); | |
} | |
state_entry() | |
{ | |
// llSensorRepeat("", NULL_KEY, AGENT_BY_LEGACY_NAME, 10.0, PI, 10); | |
} | |
touch_start(integer total_number) | |
{ | |
llSay(0, "Touched."); | |
llSetStatus(STATUS_PHYSICS, FALSE); | |
llSetPos(llGetPos() + <0,0,50>); | |
llSetStatus(STATUS_PHYSICS, TRUE); | |
} | |
sensor(integer num_detected) | |
{ | |
float speed = llVecMag(llGetVel()); | |
llSay(0, "llVecMag="+(string)(speed)); | |
if (speed < .001 ) { | |
llSay(0, "stopped"); | |
llSetStatus(STATUS_PHYSICS, FALSE); | |
llSetPos(llGetPos() + <0,0,50>); | |
llSetStatus(STATUS_PHYSICS, TRUE); | |
} | |
} | |
collision(integer num_detected) | |
{ | |
//vector speed = llGetVel(); | |
//speed.z = speed.z * -1; | |
//llSay(0, "collided"); | |
//llSetVelocity(speed, FALSE); | |
llSetVelocity(<0,0,12>, FALSE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment