Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005947opensim[REGION] Script Functionspublic2012-03-27 18:062012-04-06 12:36
Reporterkevinbuckley70 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005947: llMoveToTarget() or llTarget() misbehave when linked to other prims
DescriptionIf you use llMoveToTarget() to move a physical object up & down, & use llTarget to know when it's there, this stops working when you link an additional prim.

Either llMoveToTarget uses the wrong linkset vector OR llTarget does (or the physics just doesn't have enough energy to get there!) - in any case, in the upwards direction, the linkset falls short of the scripted target & at_target() event never triggers.
Steps To ReproduceCreate a prim (size 4x4x0.5) & put the below script into it. Watch it successfully move up & down every 5 seconds.

Create another prim (size 2x2x2) & link it 1m above the centre of the previous prim so the previous prim is root. Now, the linkset never reaches the vector specified in llMoveToTarget(). It CAN be triggered by editing the linkset & manually nudging it.

Script for test:

float atTargetDelta = 0.1;
vector initialPosition;
rotation initialRotation;
integer targetHandle;
integer down;

default
{
    on_rez(integer channel)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llSetStatus(STATUS_PHYSICS, FALSE);
        initialPosition = llGetPos();
        initialRotation = llGetRot();
        down = TRUE;
        state waiting;
    }
}

state waiting
{
    on_rez(integer channel)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llSetTimerEvent(5.0);
    }

    timer()
    {
        llSetTimerEvent(0.0);
        if (down)
        {
            state goUpPhysical;
        } else
        {
            state goDownPhysical;
        }
    }
}
    
state goUpPhysical
{
    on_rez(integer channel)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llOwnerSay("Target position = " + (string)(initialPosition + <0.0, 0.0, 10.0>));
        llSetTimerEvent(0.5);
        targetHandle = llTarget(initialPosition + <0.0, 0.0, 10.0>, atTargetDelta);
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_ROTATE_X| STATUS_ROTATE_Y| STATUS_ROTATE_Z, FALSE);// Stop it tilting (doesnt work btw!!)
        llMoveToTarget(initialPosition + <0.0, 0.0, 10.0>, 0.2);
    }
    
    timer()
    {
        llOwnerSay("Current position = " + (string)llGetPos());
    }
    
    at_target(integer tnum, vector targetpos, vector ourpos)
    {
        llTargetRemove(tnum);// Ensure the correct handle is cleared!!
        llStopMoveToTarget();
        llSetTimerEvent(0.0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        llOwnerSay("At target (up)");
        llSetPos(initialPosition + <0.0, 0.0, 10.0>);
        llSetRot(initialRotation);
        down = FALSE;
        state waiting;
    }
}

state goDownPhysical
{
    on_rez(integer channel)
    {
        llResetScript();
    }
    
    state_entry()
    {
        llOwnerSay("Target position = " + (string)(initialPosition));
        llSetTimerEvent(0.5);
        targetHandle = llTarget(initialPosition, atTargetDelta);
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_ROTATE_X| STATUS_ROTATE_Y| STATUS_ROTATE_Z, FALSE);// Stop it tilting (doesnt work btw!!)
        llMoveToTarget(initialPosition, 0.2);
    }
    
    timer()
    {
        llOwnerSay("Current position = " + (string)llGetPos());
    }
    
    at_target(integer tnum, vector targetpos, vector ourpos)
    {
        llTargetRemove(tnum);// Ensure the correct handle is cleared!!
        llStopMoveToTarget();
        llSetTimerEvent(0.0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        llOwnerSay("At target (down)");
        llSetPos(initialPosition);
        llSetRot(initialRotation);
        down = TRUE;
        state waiting;
    }
}
TagsNo tags attached.
Git Revision or version number0.7.2 release
Run Mode Standalone (Multiple Regions)
Physics EngineODE
Script Engine
EnvironmentMono / Windows
Mono VersionNone
ViewerImprudence
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2012-03-27 18:06 kevinbuckley70 New Issue
2012-04-06 12:36 justincc Relationship added related to 0005954
2012-04-06 12:37 justincc Relationship deleted related to 0005954


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker