Position change

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Emblem-important-yellow.png LSL Feature Request
The described event does not exist. This article is a feature request.

Description

Event: position_change( ){ ; }

An event for avatar transitions from sitting to standing, standing to flying, etc. Such events can be monitored with a timer event; however, that's murder on a server. Must call llTrackAvatarPositionChange with permission PERMISSION_TRACK_POSITION.


Caveats

All Issues ~ Search JIRA for related Bugs

Examples

Notes

And this is different then using (not_)at_target how? --Strife Onizuka 18:58, 20 April 2007 (PDT)


"It registers a position with a range that triggers at_target and not_at_target events continuously until unregistered." - we're trying to avoid continuous events as they aren't very nice to the poor sim executing them --Synack Fitzgerald 12:25, 14 May 2007 (EDT)

I guess I should have just spelled things out. You can emulate this with minimal hassle and load on the sim. The benefits do not out weight costs of developing and debugging. The benefits are marginal and it doesn't add anything to LSL that can't already be done; there is no valid reason to add this. See below. -- Strife Onizuka 04:05, 14 May 2007 (PDT)

Deep Notes

Signature



integer target;

default
{
    touch_start(integer a)
    {
        if(target)
        {
            llTargetRemove(target);
            target = 0;
        }
        else
            target = llTarget( llGetPos(), 0.001 );
    }
    not_at_target()
    {
        llTargetRemove(target);
        target = llTarget( llGetPos(), 0.001 );
    }
}
//This version tells you the change. It will have problems on sim boundaries (tracking that requires extra work).
integer target;
vector pos;

default
{
    touch_start(integer a)
    {
        if(target)
        {
            llTargetRemove(target);
            target = 0;
        }
        else
            target = llTarget( pos = llGetPos(), 0.001 );
    }
    not_at_target()
    {
        llTargetRemove(target);
        vector new_pos = llGetPos();
        target = llTarget( new_pos, 0.001 );

        llSay(0,"change = "(string)(new_pos - pos));

        pos = new_pos;
    }
}