OsTeleportObject
From OpenSimulator
m (Added permissions and delay information) |
m (XEngine to OSSL) |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{osslfunc | {{osslfunc | ||
|threat_level=Severe | |threat_level=Severe | ||
− | ||permissions=${ | + | ||permissions=${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |
|delay=0 | |delay=0 | ||
− | |function_syntax=integer osTeleportObject(key | + | |function_syntax=integer osTeleportObject(key objectID, vector targetPos, rotation rot, integer flags) |
|csharp_syntax= | |csharp_syntax= | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
Line 12: | Line 12: | ||
state_entry() | state_entry() | ||
{ | { | ||
− | ... | + | llSay(0, "Script running"); |
+ | } | ||
+ | touch_start(integer num) | ||
+ | { | ||
+ | // target position in region local coords | ||
+ | vector target =<873.911926, 879.844910, 21.332354>; | ||
+ | rotation rot =<0,0,0.707,.707>; | ||
+ | osTeleportObject(llGetKey(),target,rot,1); | ||
} | } | ||
} | } | ||
Line 19: | Line 26: | ||
===== Arguments: ===== | ===== Arguments: ===== | ||
− | * | + | * objectID the id of the linkset to teleport |
− | * targetPos target position | + | * targetPos target position in region local coords |
+ | |||
* rot a rotation. | * rot a rotation. | ||
* flags | * flags | ||
Line 26: | Line 34: | ||
===== Flags: ===== | ===== Flags: ===== | ||
* OSTPOBJ_NONE it is just 0 | * OSTPOBJ_NONE it is just 0 | ||
− | * | + | * OSTPOBJ_STOPATTARGET object is stopped at destination |
* OSTPOBJ_STOPONFAIL stops at start point if tp fails (still does nothing) | * OSTPOBJ_STOPONFAIL stops at start point if tp fails (still does nothing) | ||
* OSTPOBJ_SETROT the rotation is the final object rotation, otherwise is a added rotation | * OSTPOBJ_SETROT the rotation is the final object rotation, otherwise is a added rotation | ||
− | |additional_info=returns a integer error code: | + | |
+ | |additional_info=This function was added in 0.9.0.1 | ||
+ | returns a integer error code: | ||
* negative the teleport failed | * negative the teleport failed | ||
* Zero means that a teleport to another region was started. result needs to be checked by other means (?) | * Zero means that a teleport to another region was started. result needs to be checked by other means (?) | ||
* 1 did a local teleport | * 1 did a local teleport | ||
+ | |||
+ | This can do region crossings if the target position is on another region. | ||
+ | |||
+ | Since target position is in start region local coords, some simple math is needed | ||
+ | |||
+ | - on the target region, use llgetregioncorner to get its global coords | ||
+ | - add to that vector the target position you want on that region local coords | ||
+ | |||
+ | - on the start region use llgetregioncorner to get its global coords | ||
+ | - subtract that vector from the previus one. | ||
+ | - result is the needed value for target position | ||
+ | |||
+ | you may notice that this may work also on regions that are far apart. | ||
+ | |||
+ | but since it uses normal regions crossing code the operation is not pretty to see on viewer of sitting avatars, so do avoid it | ||
+ | |||
+ | make sure there is enough clear space on target position for the object to rez | ||
===== Restrictions: ===== | ===== Restrictions: ===== | ||
Line 40: | Line 67: | ||
* target location parcel must have enought free prims capacity for the linkset prims | * target location parcel must have enought free prims capacity for the linkset prims | ||
* all avatars siting on the object must have access to target location | * all avatars siting on the object must have access to target location | ||
− | * has a cool down time | + | * has a cool down time (1 second), retries before it expires or a reset, tp is ignored with error -2 |
* the object can not be selected at tp time | * the object can not be selected at tp time | ||
− | |||
}} | }} |
Latest revision as of 06:34, 7 November 2019
integer osTeleportObject(key objectID, vector targetPos, rotation rot, integer flags)
| |
...
Arguments:
Flags:
| |
Threat Level | Severe |
Permissions | ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |
Extra Delay | 0 seconds |
Example(s) | |
// Example of osTeleportObject default { state_entry() { llSay(0, "Script running"); } touch_start(integer num) { // target position in region local coords vector target =<873.911926, 879.844910, 21.332354>; rotation rot =<0,0,0.707,.707>; osTeleportObject(llGetKey(),target,rot,1); } } | |
Notes | |
This function was added in 0.9.0.1
returns a integer error code:
This can do region crossings if the target position is on another region. Since target position is in start region local coords, some simple math is needed - on the target region, use llgetregioncorner to get its global coords - add to that vector the target position you want on that region local coords - on the start region use llgetregioncorner to get its global coords - subtract that vector from the previus one. - result is the needed value for target position you may notice that this may work also on regions that are far apart. but since it uses normal regions crossing code the operation is not pretty to see on viewer of sitting avatars, so do avoid it make sure there is enough clear space on target position for the object to rez Restrictions:
|