OsLocalTeleportAgent
From OpenSimulator
(3 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
vector TPvel = <0,0,0>; | vector TPvel = <0,0,0>; | ||
vector LookAt = <1,1,0>; // which way they look at when arriving | vector LookAt = <1,1,0>; // which way they look at when arriving | ||
− | + | ||
// | // | ||
default | default | ||
Line 21: | Line 21: | ||
key avatar = llDetectedKey(0); | key avatar = llDetectedKey(0); | ||
llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint); | llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint); | ||
− | osLocalTeleportAgent(avatar, LandingPoint, TPvel, LookAt, | + | osLocalTeleportAgent(avatar, LandingPoint, TPvel, LookAt, OS_LTPAG_USELOOKAT | OS_LTPAG_FORCEFLY); |
} | } | ||
}</source> | }</source> | ||
|description= | |description= | ||
− | |||
− | |||
− | |||
Teleports an avatar with uuid agentID to the specified newPosition within same region.<br> | Teleports an avatar with uuid agentID to the specified newPosition within same region.<br> | ||
It ignores region teleport settings like Telehub or landpoint<br> | It ignores region teleport settings like Telehub or landpoint<br> | ||
<br> | <br> | ||
The avatar must have rights to enter the target position.<br> | The avatar must have rights to enter the target position.<br> | ||
− | The avatar must had granted PERMISSION_TELEPORT to the script or the owner of the prim containing the script | + | The avatar must had granted PERMISSION_TELEPORT to the script or the owner of the prim containing the script is also be owner of the parcel where the avatar is currently on.<br> |
The function will fail silently if conditions are not meet.<br> | The function will fail silently if conditions are not meet.<br> | ||
<br> | <br> | ||
- If newPosition is outside the region the target will be at nearest region border.<br> | - If newPosition is outside the region the target will be at nearest region border.<br> | ||
− | - newVelocity, if selected with optionFlags bit 0 set, 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. If bit 0 is not set, current velocity is kept<br> | + | - newVelocity, if selected with optionFlags bit 0 set, should set a avatar velocity, but may only work with ubOde Physics engine, even so results may be a bit unpredictable. |
− | - newLookAt, if selected with optionFlags bit 1 set, changes the avatar look at direction. Bit 2 can alternatively be used to align the look at to the velocity, if that is not zero vector. Camera direction will depend on viewer camera state at teleport time (like camera attached to avatar or free). Look at is the direction the avatar head will face. Body will face close to that, depending on viewers. Look At Z component is zero. If both bits are not set, the look at direction will be the current camera direction<br> | + | |
+ | 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. If bit 0 is not set, current velocity is kept<br> | ||
+ | |||
+ | - newLookAt, if selected with optionFlags bit 1 set, changes the avatar look at direction. | ||
+ | |||
+ | Bit 2 can alternatively be used to align the look at to the velocity, if that is not zero vector. | ||
+ | |||
+ | Camera direction will depend on viewer camera state at teleport time (like camera attached to avatar or free). | ||
+ | |||
+ | Look at is the direction the avatar head will face. Body will face close to that, depending on viewers. Look At Z component is zero. | ||
+ | |||
+ | If both bits are not set, the look at direction will be the current camera direction<br> | ||
- OptionFlags is a bit field:<br> | - OptionFlags is a bit field:<br> |
Latest revision as of 17:38, 16 September 2021
osLocalTeleportAgent(key agentID, vector newPosition, vector newVelocity, vector newLookat, integer optionFlags)
| |
Teleports an avatar with uuid agentID to the specified newPosition within same region. It ignores region teleport settings like Telehub or landpoint 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. If bit 0 is not set, current velocity is kept - newLookAt, if selected with optionFlags bit 1 set, changes the avatar look at direction. Bit 2 can alternatively be used to align the look at to the velocity, if that is not zero vector. Camera direction will depend on viewer camera state at teleport time (like camera attached to avatar or free). Look at is the direction the avatar head will face. Body will face close to that, depending on viewers. Look At Z component is zero. If both bits are not set, the look at direction will be the current camera direction - OptionFlags is a bit field: | |
Threat Level | None |
Permissions | see description |
Extra Delay | 0 seconds |
Example(s) | |
vector LandingPoint = <128,128,50>; // X,Y,Z landing point for avatar to arrive at vector TPvel = <0,0,0>; 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, TPvel, LookAt, OS_LTPAG_USELOOKAT | OS_LTPAG_FORCEFLY); } } |