Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002311opensim[REGION] Physics Enginespublic2008-10-01 15:032009-09-19 07:29
ReporterRobert Adams 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusfeedbackResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0002311: llApplyImpulse applys incorrect push
DescriptionIn trying to stop a physical prim with llApplyImpulse(-llGetVel()*llGetMass(), FALSE), I find that the prim does not stop but it goes backward.

The script given below, trys to stop a 5x5x5 cube prim every 5 seconds after an initial small push. The effect is the prim goes back and forth at an increasingly quick rate -- speed of 1, -2, 4 -8, 16, ...
Additional InformationAdding the following script to a prim:
//LSL
string gAppName = "BTImpluseTest";
integer gAppVersion = 1;
integer DDEBUG = TRUE;
integer DCHAN = 0; // channel debug messages are sent on

integer gTryToStop = FALSE;
integer gTick = 0;

default {
    state_entry() {
        gTryToStop = FALSE;
        gTick = 1;
        llSetBuoyancy(1.0); // action is to fly-like
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetTimerEvent(1.0);
    }
    
    timer() {
        if (((gTick++) % 5) == 0) {
            if (gTryToStop) {
                // try to stop moving
                if (DDEBUG) llShout(DCHAN, gAppName+": trying to stop");
                if (DDEBUG) llShout(DCHAN, gAppName+": mass="+(string)llGetMass()+", vel="+(string)llGetVel());
                vector stopVector = -llGetVel()*llGetMass();
                if (DDEBUG) llShout(DCHAN, gAppName+": stopVector="+(string)stopVector);
                llApplyImpulse(stopVector, FALSE);
            }
            else {
                // first time through, apply a little movement
                vector initialPush = llGetMass()*<0.0, 0.5, 0.0>;
                if (DDEBUG) llShout(DCHAN, gAppName+": first initial push: "+(string)initialPush);
                llApplyImpulse(initialPush, FALSE);
                if (DDEBUG) llShout(DCHAN, gAppName+": mass="+(string)llGetMass()+", vel="+(string)llGetVel());
                gTryToStop = TRUE;
            }
        }
        else {
            if (DDEBUG) llShout(DCHAN, gAppName+": vel="+(string)llGetVel());
        }
    }
}
============= END ==============
Generates the following output:
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[13:48] Primitive shouts: BTImpluseTest: first initial push: <0.000000,625.000427,0.000000>
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,0.000000,0.000000>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,2.000000,0.000001>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,1.500000,0.000001>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,1.000000,0.000001>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,1.000000,0.000001>
[13:48] Primitive shouts: BTImpluseTest: trying to stop
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,1.000000,0.000001>
[13:48] Primitive shouts: BTImpluseTest: stopVector=<0.000000,-1250.000854,-0.001316>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-2.000000,-0.000002>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-2.000000,-0.000002>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-2.000000,-0.000002>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-2.000000,-0.000001>
[13:48] Primitive shouts: BTImpluseTest: trying to stop
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,-2.000000,-0.000001>
[13:48] Primitive shouts: BTImpluseTest: stopVector=<0.000000,2500.001709,0.001612>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,4.000000,0.000003>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,4.000000,0.000003>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,4.000000,0.000003>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,4.000000,0.000003>
[13:48] Primitive shouts: BTImpluseTest: trying to stop
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,4.000000,0.000003>
[13:48] Primitive shouts: BTImpluseTest: stopVector=<0.000000,-5000.003418,-0.004176>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-8.000000,-0.000007>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-8.000000,-0.000006>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-8.000000,-0.000006>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-8.000000,-0.000006>
[13:48] Primitive shouts: BTImpluseTest: trying to stop
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,-4.000000,-0.000003>
[13:48] Primitive shouts: BTImpluseTest: stopVector=<0.000000,5000.003418,0.003694>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,8.000000,0.000006>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,8.000000,0.000006>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,8.000000,0.000006>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,8.000000,0.000007>
[13:48] Primitive shouts: BTImpluseTest: trying to stop
[13:48] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,8.000000,0.000007>
[13:48] Primitive shouts: BTImpluseTest: stopVector=<0.000000,-10000.006836,-0.008390>
[13:48] Primitive shouts: BTImpluseTest: vel=<0.000000,-16.000000,-0.000013>
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineODE
Script Engine
Environment.NET / Windows32
Mono Version
Viewer
Attached Files

- Relationships

-  Notes
(0013542)
Fly-Man- (developer)
2009-09-19 07:29

Test that I did gives about the same error:

[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,0.000000,0.000000>
[16:18] Primitive shouts: BTImpluseTest: first initial push: <0.000000,625.000427,0.000000>
[16:18] Primitive shouts: BTImpluseTest: mass=1250.000854, vel=<0.000000,0.000000,0.000000>
[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,2.000000,0.000001>
[16:18] Primitive shouts: BTImpluseTest: vel=<0.000000,1.500000,0.000001>
[16:19] Primitive shouts: BTImpluseTest: vel=<0.000000,1.000000,0.000001>
[16:19] Primitive shouts: BTImpluseTest: vel=<0.000000,1.000000,0.000001>
[16:19] Primitive shouts: BTImpluseTest: trying to stop

- Issue History
Date Modified Username Field Change
2008-10-01 15:03 Robert Adams New Issue
2008-10-01 15:03 Robert Adams SVN Revision => 0
2008-10-01 15:03 Robert Adams Run Mode => Grid (Multiple Regions per Sim)
2008-10-01 15:03 Robert Adams Physics Engine => ODE
2008-10-01 15:03 Robert Adams Environment => .NET / Windows32
2009-09-19 07:29 Fly-Man- Note Added: 0013542
2009-09-19 07:29 Fly-Man- Status new => feedback


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker