Difference between revisions of "Position change"

From Second Life Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by one other user not shown)
Line 6: Line 6:
|caveats=*If [[PERMISSION_TRACK_POSITION]] is not set when [[llTrackAvatarPositionChange]] is not set then "Permissions do not allow to track avatars position change." is shouted on [[DEBUG_CHANNEL]].
|caveats=*If [[PERMISSION_TRACK_POSITION]] is not set when [[llTrackAvatarPositionChange]] is not set then "Permissions do not allow to track avatars position change." is shouted on [[DEBUG_CHANNEL]].
|notes=And this is different then using ([[not_at_target|not_]])[[at_target]] how? --[[User:Strife Onizuka|Strife Onizuka]] 18:58, 20 April 2007 (PDT)
|notes=And this is different then using ([[not_at_target|not_]])[[at_target]] how? --[[User:Strife Onizuka|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 --[[User:Synack Fitzgerald|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. -- [[User:Strife Onizuka|Strife Onizuka]] 04:05, 14 May 2007 (PDT)
}}
}}
----
<pre>
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 );
    }
}
</pre>
<pre>
//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;
    }
}
</pre>

Latest revision as of 03:05, 14 May 2007

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


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;
    }
}