OsLocalTeleportAgent

From OpenSimulator

Revision as of 14:58, 1 May 2019 by Ubit (Talk | contribs)

Jump to: navigation, search
void osLocalTeleportAgent(key agentID, vector newPosition, vector newVelocity, vector newLookat, integer optionFlags)

Caution ! still experimental, subject to changes

Teleports an avatar with uuid agentID to the specified newPosition within same region.
The avatar must have rights to enter the target position.
The avatar must had granted PERMISSION_TELEPORT to the script or the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on.
The function will fail silently if conditions are not meet.

- If newPosition is outside the region the target will be at nearest region border.
- newVelocity, if selected in optionFlags bit 0, should set a avatar velocity, but may only work with ubOde Physics engine, even so results may be a bit unpredictable. It will stop if the avatar collides with anything at destination or if the user presses a movement key. It also has a fast decay. This behavior will need future changes.
- newLookAt, if selected in optionFlags bit 1, changes the camera look At direction. bit 2 can alternatively be used to align the look at to the velocity at arrival if this is not Zero. Final effect may depend on viewer and viewer camera state at teleport time (like camera attached to avatar or free). newLookAt and final lookAt is a direction and its Z is zero

- OptionFlags is a bit field:
bit 0 (mask 1): use newVelocity
bit 1 (mask 2): use newLookAt
bit 2 (mask 4): align lookat to velocity if it is not zero vector
bit 3 (mask 8): force fly
bit 4 (mask 16): force no fly

if both bits 1 and 2 are set bit 2 is ignored
if both bits 3 and 4 are set bit 4 is ignored
if optionFlags is zero, current avatar parameters will be preserved.

Threat Level None
Permissions see description
Delay 0 seconds
Example(s)
vector LandingPoint = <128,128,50>; // X,Y,Z landing point for avatar to arrive at
vector LookAt = <1,1,0>; // which way they look at when arriving
//
default
{
  state_entry()
  {
    llWhisper(0, "OS Local Teleport Active");
  }
  touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint);
    osLocalTeleportAgent(avatar, LandingPoint, ZEROVECTOR, LookAt, 2); 
  }
}
Personal tools
General
About This Wiki