OsTeleportObject
From OpenSimulator
(Difference between revisions)
Line 42: | Line 42: | ||
* 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, so do avoid it | ||
===== Restrictions: ===== | ===== Restrictions: ===== | ||
Line 51: | Line 64: | ||
* the object can not be selected at tp time | * the object can not be selected at tp time | ||
− | make sure there is enough clear space on target position for the object to | + | make sure there is enough clear space on target position for the object to rez |
| | | | ||
}} | }} |
Revision as of 00:50, 18 April 2018
integer osTeleportObject(key objectUUID, vector targetPos, rotation rot, int flags)
| |
...
Arguments:
Flags:
| |
Threat Level | Severe |
Permissions | ${XEngine|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>; osObjectTeleport(llGetKey(),target,rot,1); } } | |
Notes | |
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, so do avoid it Restrictions:
make sure there is enough clear space on target position for the object to rez |