MantisBT - opensim
View Issue Details
0005964opensim[REGION] Script Functionspublic2012-04-15 21:022012-04-18 08:23
Kayaker Magic 
Griddal 0.7.1 Dev Griddal/r10Griddal 0.7.1
master (dev code) 
Standalone (Multiple Regions)
0005964: llSetStatus(STATUS_PHYSICS,FALSE) fails on moving object
When llSetStatus is used to turn physics off, it fails if the object is still moving under the influence of a llMoveToTarget call. Even if llStopMoveToTarget() is called first. It fails in a spectacular way with the object taking off at an ever accelerating velocity, off the edge of the SIM never to be seen again. If, however, you wait for the llMoveToTarget to finish, then the llSetStatus(STATUS_PHYSICS,FALSE) call works.

A workaround is to call llMoveToTarget(llGetPos(),0.05), then sleep for at least 0.05 seconds. This apparently aborts the previous move, then gives the new one time to finish. Then it is safe to call llSetStatus.
To reproduce:
    Create a prim, place it a meter or so above the ground, place the following scrip in it. Click on the prim and wait for the motion to stop before clicking again. Note the correct behavior. Starting with the green floating text, (Touch to make physical) click on the prim twice rapidly (less than 5 seconds apart). Observe that the prim takes off at high speed. If you are focused on it, you may be able to click it again to stop it. If you are successful, it returns to a position that indicates llGetPos is unaware of the runaway position of the prim.

//physics on/off test
// demonstrates the problem with llSetStatus(STATUS_PHYSICS,FALSE)
// on a moving object.
vector move=<2,1,0>; //short move to show physics
        llSetStatus(STATUS_PHYSICS,FALSE); //make sure physics is off for starters
        llSetText("Touch to start",<0,1,0>,1.0);
    touch_start(integer num)
        if (llGetStatus(STATUS_PHYSICS)==FALSE)
            llSetStatus(STATUS_PHYSICS,TRUE); //turn physics on
            llMoveToTarget(llGetPos()+move,5.0); //move to a new position over 5 seconds
            llSetText("Touch to make NON physical",<1,0,0>,1.0);
            move *= -1; //reverse direction for next time
                    //WORKAROUND: un-comment the following two lines
// llMoveToTarget(llGetPos(),0.05); //stop in your tracks! Please!
// llSleep(.10); //Give it time to take effect

            llStopMoveToTarget(); //stop last move
            llSetStatus(STATUS_PHYSICS,FALSE); //turn physics off
            llSetText("Touch to make physical",<0,1,0>,1.0);
No tags attached.
Issue History
2012-04-15 21:02Kayaker MagicNew Issue
2012-04-18 08:23TalunNote Added: 0021264
2012-04-18 08:23TalunNote Edited: 0021264bug_revision_view_page.php?bugnote_id=21264#r283

2012-04-18 08:23   
This appears to behave properly on a build of the leading edge running standalone (Imprudence say it is "OpenSim 0.7.4 Dev"). prim stops and reverses in good order, ODE on XP.