MantisBT - opensim
View Issue Details
0008140opensim[REGION] Script Functionspublic2017-04-03 11:102017-06-26 03:24
master (dev code) 
master (dev code) 
Standalone (1 Region)
0008140: new Experimental osTeleportObject
I added on master, a new experimental function
integer osObjectTeleport(key objectUUID, vector targetPos, rotation rot, int flags)

- objectUUID the id of the linkset to teleport
- targetPos target position
- rot a rotation.
- flags

returns a integer error code:
 - negative the teleport failed
 - Zero means that a teleport to another region was started. result needs to be checked by other means (?)
 - 1 did a local teleport

OSTPOBJ_NONE it is just 0
OSTPOBJ_STOPATTARRGET object is stopped at destination
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

this are can be combined by binary or | as usual

- ThreatLevel(ThreatLevel.Severe, "osTeleportObject")
- if object has scripts, owner must have rights to run scripts on target location
- object owner must have rights to enter ojects on target location
- 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
- has a cool down time. retries before expire reset it, and tp is ignored with error -2
- the object can not be selected at tp time

note that you need to make sure the object may physical rez on the target position. Any collisions like from rezing inside another object may have ugly results.

teleports to other regions may depend on viewers and may go very wrong.
they can take time, and sitting victims may see ugly things until done

if you have the time to test, let us know the many ways how it does crash your test regions and your prims ;)

code is not final, restrictions are to enforce the normal parcel permissions, to prevent bad use, etc, and are not final.

No tags attached.
Issue History
2017-04-03 11:10UbitUmarovNew Issue
2017-04-03 11:10UbitUmarovStatusnew => assigned
2017-04-03 11:10UbitUmarovAssigned To => UbitUmarov
2017-04-03 14:56BillBlightNote Added: 0031678
2017-04-03 15:01BillBlightNote Edited: 0031678bug_revision_view_page.php?bugnote_id=31678#r6059
2017-04-03 15:08UbitUmarovNote Added: 0031679
2017-04-03 15:15BillBlightNote Added: 0031680
2017-04-03 15:19BillBlightNote Added: 0031681
2017-04-03 15:40UbitUmarovNote Added: 0031682
2017-04-03 15:42BillBlightNote Added: 0031683
2017-04-03 15:47BillBlightNote Edited: 0031683bug_revision_view_page.php?bugnote_id=31683#r6061
2017-04-03 16:07UbitUmarovNote Added: 0031684
2017-04-03 16:09BillBlightNote Added: 0031685
2017-04-03 16:12BillBlightNote Added: 0031686
2017-04-03 16:14UbitUmarovNote Added: 0031687
2017-04-03 16:19BillBlightNote Added: 0031688
2017-04-03 16:21BillBlightNote Edited: 0031688bug_revision_view_page.php?bugnote_id=31688#r6063
2017-04-03 16:59UbitUmarovNote Added: 0031689
2017-04-03 17:04BillBlightNote Added: 0031690
2017-04-03 17:05BillBlightNote Edited: 0031690bug_revision_view_page.php?bugnote_id=31690#r6065
2017-04-03 17:05BillBlightNote Edited: 0031690bug_revision_view_page.php?bugnote_id=31690#r6066
2017-04-03 17:29BillBlightNote Added: 0031691
2017-04-03 17:32UbitUmarovNote Added: 0031692
2017-04-03 17:33BillBlightNote Added: 0031693
2017-04-03 17:39BillBlightNote Added: 0031694
2017-04-03 17:42BillBlightNote Added: 0031695
2017-04-03 17:42UbitUmarovNote Added: 0031696
2017-04-03 17:44BillBlightNote Added: 0031697
2017-04-03 18:49BillBlightNote Added: 0031698
2017-04-03 18:50BillBlightNote Edited: 0031698bug_revision_view_page.php?bugnote_id=31698#r6068
2017-04-03 18:57UbitUmarovNote Added: 0031699
2017-04-03 18:58UbitUmarovNote Added: 0031700
2017-04-03 18:59BillBlightNote Added: 0031701
2017-04-03 19:00BillBlightNote Edited: 0031701bug_revision_view_page.php?bugnote_id=31701#r6070
2017-04-03 19:02BillBlightNote Added: 0031702
2017-04-03 19:05UbitUmarovDescription Updatedbug_revision_view_page.php?rev_id=6072#r6072
2017-04-04 06:46UbitUmarovSummarynew Experimental osObjectTeleport => new Experimental osTeleportObject
2017-04-04 06:46UbitUmarovDescription Updatedbug_revision_view_page.php?rev_id=6073#r6073
2017-04-04 06:51UbitUmarovNote Added: 0031704
2017-04-05 01:52aiaustinNote Added: 0031711
2017-04-05 01:52aiaustinNote Edited: 0031711bug_revision_view_page.php?bugnote_id=31711#r6083
2017-04-05 05:56UbitUmarovNote Added: 0031713
2017-04-05 22:10BillBlightNote Added: 0031721
2017-04-05 22:30UbitUmarovNote Added: 0031722
2017-04-05 22:34BillBlightNote Added: 0031723
2017-04-05 22:36BillBlightNote Added: 0031724
2017-04-05 22:38BillBlightNote Edited: 0031724bug_revision_view_page.php?bugnote_id=31724#r6089
2017-04-05 23:27BillBlightNote Added: 0031725
2017-04-06 10:31BillBlightNote Added: 0031726
2017-04-15 03:05UbitUmarovDescription Updatedbug_revision_view_page.php?rev_id=6106#r6106
2017-04-15 03:07UbitUmarovNote Added: 0031755
2017-04-15 03:14UbitUmarovNote Added: 0031757
2017-04-15 03:24UbitUmarovDescription Updatedbug_revision_view_page.php?rev_id=6107#r6107
2017-04-15 03:26UbitUmarovDescription Updatedbug_revision_view_page.php?rev_id=6108#r6108
2017-04-16 01:12djphilNote Added: 0031766
2017-04-16 01:12djphilNote Edited: 0031766bug_revision_view_page.php?bugnote_id=31766#r6112
2017-04-16 01:13djphilNote Edited: 0031766bug_revision_view_page.php?bugnote_id=31766#r6113
2017-04-16 01:14djphilNote Edited: 0031766bug_revision_view_page.php?bugnote_id=31766#r6114
2017-04-16 01:15djphilNote Edited: 0031766bug_revision_view_page.php?bugnote_id=31766#r6115
2017-04-16 01:16djphilNote Edited: 0031766bug_revision_view_page.php?bugnote_id=31766#r6116
2017-04-16 07:21BillBlightNote Added: 0031769
2017-04-16 07:23BillBlightNote Edited: 0031769bug_revision_view_page.php?bugnote_id=31769#r6118
2017-04-16 07:27djphilNote Added: 0031770
2017-04-16 07:27djphilNote Edited: 0031770bug_revision_view_page.php?bugnote_id=31770#r6120
2017-04-16 07:28djphilNote Edited: 0031770bug_revision_view_page.php?bugnote_id=31770#r6121
2017-04-16 07:30BillBlightNote Added: 0031771
2017-04-16 07:30BillBlightNote Edited: 0031771bug_revision_view_page.php?bugnote_id=31771#r6123
2017-04-16 07:32djphilNote Added: 0031772
2017-04-17 04:51UbitUmarovNote Added: 0031774
2017-06-26 03:24djphilNote Added: 0032079
2017-06-28 16:23djphilNote Edited: 0032079bug_revision_view_page.php?bugnote_id=32079#r6329

2017-04-03 14:56   
(edited on: 2017-04-03 15:01)

I have tested this, works great, rotation seems to be an issue, I'd have to say it is not working ..

I have tested with physical and non-physical prims both with and without seated avatars .. Did some testing with a small link set.

Other than the rotation it seems to work fine.

nit pick .. Maybe it should have been osTeleportObject, instead of osObjectTeleport to keep with the standard for the other OS tp functions such as osTeleportAvatar
p.s I have dreamed of this function, thank you so much ubit ...

2017-04-03 15:08   
rotation does what? nothing or wrong rotation?
2017-04-03 15:15   
Sorry I should have been more precise, rotation does nothing ...

I just did a video of it , will post a link in a new comment when it uploads
2017-04-03 15:19 [^] video of results, it works but the saved origin rotation is not being applied on the TP ..
2017-04-03 15:40   
can you show the script?
at least the tp part
2017-04-03 15:42   
(edited on: 2017-04-03 15:47)
Here it is using this combination ..

vector target =<873.911926, 879.844910, 21.332354>;
rotation rot =<0.000000, 0.000000, 0.000000, 1.000000>;

I can do an llSetRot(rot);

after the tp and it returns to the correct orientation.

2017-04-03 16:07   
your rot means no rotation.
the parameter is not the final rotation, but a rotation applied during the tp
try 0,0,0.707,.707>
objects should arrive rotated 90º around Z relative to orientation bf tp.
a vehicle should have its velocity also rotated
2017-04-03 16:09   
I'll try that but the object started with no rotation, moved it rotated it, and on TP it did not go back to no rotation. But I will test yours ..
2017-04-03 16:12   
tested with

        llSay(0, "Script running");
    touch_start(integer num)
        vector target =<873.911926, 879.844910, 21.332354>;
rotation rot =<0,0,0.707,.707>;

It still stays at whatever rotation it was at before the TP, the rotation is not applied.
2017-04-03 16:14   
ooops yeap bug im doing the orientation rotation only if stop = FALSE
2017-04-03 16:19   
(edited on: 2017-04-03 16:21)
ahhh Yes tested it with stop = FALSE and that works ... (sucks for a physical object you want to make stop dead though)

So I was always testing with stop = TRUE, due to wanting to use it for physical vehicle auto return ..

My bad I should have done more testing ... Then could have pointed straight at it.

I have faith ...

2017-04-03 16:59   
fixed on master, I hope :)
2017-04-03 17:04   
(edited on: 2017-04-03 17:05)
ummm Now rotation does not work either way stop true||false .... doubled checked I did pull and compile the master right after your commit ..

I'll pull it again in a few and retry.

2017-04-03 17:29   
Freshly pulled and compiled, TP works but rotation does not seem to want to work if stop is true or false ...

I am using the same script I was using earlier to test.
2017-04-03 17:32   
strange, im teleporting cars on my test region and they do rotate 90º in my test :(
2017-04-03 17:33   
Well let me make a fresh script and try it again .. maybe it is a script cache issue
2017-04-03 17:39   
I think I see the issue .. it is multiplying the rotation, not setting it, every time I trigger the tp it changes the landing rotation just a little .

I can make a video if you like ..

so on each subsequent tp the rotation gets multiplied by the quaternions rather than simply setting them .. That is what it looks like to me.

For instance if I leave the block and do not move it each click sends it to a new rotation.
2017-04-03 17:42 [^]
2017-04-03 17:42   
can you log at osgrid? easier than chatting here:)
2017-04-03 17:44   
You want to jump to my region I am testing on? Life

That way we can have "real world" look at it ..

If not I can jump in OsGrid ..
2017-04-03 18:49   
(edited on: 2017-04-03 18:50)
Ok Ubit and I had a slight misunderstanding of the rot.

The rot in the osObjectTeleport is a multiplication of the initial rot, so as to maintain or create your original heading and velocity, when teleporting a moving object.

so if you want to return an object to its base rotation you have to either do some math on some variables or use an llSetRot after the TP ...

This new function seems to be working correctly.

IMHO: It would be better to have it be a set rot rather than a multiplication, as you could always calculate the destination rot. But for maintaining velocities I fully understand where Ubit went with this. Maybe it could be a set rot if stop is TRUE ..

2017-04-03 18:57   
to maintain original orientation(and heading etc) just use <0,0,0,1> or ZERO_ROTATION
2017-04-03 18:58   
forgot to say that if a object is selected the tp will also fail silently
2017-04-03 18:59   
(edited on: 2017-04-03 19:00)
I did not mean original, I meant origin or home rotation, for instance if you wanted to tp a vehicle back to it's starting point facing the way it originally started out, before you ever started driving it.

2017-04-03 19:02   
For instance, if say you want to TP a race car back to the starting line, after someone crashes it, you would not want it landing at the starting line upside down backwards .
2017-04-04 06:51   
changed the function name to osTeleportObject, and replaced stop argument with flags, updated this mantis description so new readers read updated specs.
it should now be possible to set the final object rotation if flag OSTPOBJ_SETROT is present or add a rotation if not
2017-04-05 01:52   
@Ubit, in bin/config-include/osslEnable.ini I think you used the old name of the function...

+ Allow_osObjectTeleport = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER

that should be osTeleportObject now I think to match the current function name and the corresponding osTeleportAgent

2017-04-05 05:56   
yeack... fixed
2017-04-05 22:10   
Rotation seems to still be added even with the flag, testing with this script, not as my other script this is affecting an external prim.

    touch_start(integer num)
        key testobj = "5ef963af-b9f9-4dc4-99e9-e0974e95714a";
     osTeleportObject(testobj,<239.162994, 281.208649, 22.711197> , <0.700000, 0.700000, 0.700000, 0.700000>,OSTPOBJ_SETROT);

(I actually thought it was working right in the first two tests but then realized I had left a llSetRot at the bottom of the script)
2017-04-05 22:30   
<0.700000, 0.700000, 0.700000, 0.700000> is not a valid rotation.
if you have trouble with rotations in this form use
rotation rot = llEuler2Rot(...);
for example
rotation rot = llEuler2Rot(,0,0, 45 * DEG_TO_RAD);
to get a rotation of 45º around the z axis.
2017-04-05 22:34   
Ooops that was a typo in the script ..

but that was not the only rotation I tested with, I tested with returning it to
<0.000000, 0.000000, 0.000000, 1.000000> that and ZERO_ROTATION as well ... but I will test again just to be sure ..
2017-04-05 22:36   
(edited on: 2017-04-05 22:38)

    touch_start(integer num)
        key testobj = "3f821899-2902-4bca-b5b8-cdb138778791";
     osTeleportObject(testobj,<239.162994, 281.208649, 22.711197> , <0,0,0.707,.707>,OSTPOBJ_SETROT);

Every tp it still gets a new rotation , like the rot is still getting added ...

(that top set rot that was there is not actually in my test script, pasted the wrong one again)

2017-04-05 23:27   
Ubit has confirmed with some testing that the rotation is still bugged ..
2017-04-06 10:31   
I would like to confirm , at lest in my testing today, that what we saw last night with the fix, that this latest commit does fix the rotation issue we were seeing. Thank you Ubit.
2017-04-15 03:07   
changed the specifications.
your avatar and objects may now suffer terrible things testing teleport to other regions
2017-04-15 03:14   
totally untested with bullet.
At this point ubOde is a requirement for teleports to other regions.
2017-04-16 01:12   
(edited on: 2017-04-16 01:16)
With the script below, if I click a little too quickly on the box (to perform round trip) the script will hang and the action does not take place.
If I click less quickly then that seems to work fine.
(Tested with ubODE)

key uuid;
integer flipflop;
rotation rotate;

        uuid = llGetKey();
        rotate = llEuler2Rot(<0.0, 33.0, 90.0>*DEG_TO_RAD);

    touch_start(integer number)
        flipflop =! flipflop;
        if (flipflop) osTeleportObject(uuid, <128.0, 128.0, 30.0>, rotate, OSTPOBJ_SETROT);
        else osTeleportObject(uuid, <128.0, 128.0, 25.5>, ZERO_ROTATION, OSTPOBJ_SETROT);

2017-04-16 07:21   
(edited on: 2017-04-16 07:23)
djphil, from the specs above
"- has a cool down time. retries before expire reset it, and tp is ignored with error -2"

I think that is what you are seeing, since it is all in one script, use two objects and it will work back to back.

2017-04-16 07:27   
(edited on: 2017-04-16 07:28)
Yeah, Ubit told me earlier that there may be 1 second waiting on the same area and up to 30 sec waiting and teleporting to another area.

2017-04-16 07:30   
Is the TP to other regions enabled in the master? Am I missing the syntax in the specs for that? All I see is a vector?

2017-04-16 07:32   
I do not know, i did not try that.
2017-04-17 04:51   
targetPos is the position in region coordinates, ie relative to its reference corner.
if targetPos it is outside the region limits, a search will be made for a region with that point, and if found a kind of tp is tried. It is actually a extension to regions crossing code.

so to teleport to another region you need to know the target position in global coordinates.
ie on the target region you can do for example
vector globalPos = llGetPos() + llGetRegionCorner();
llOwnerSay((String) globalPos);

then on the teleport region script
vector targetPos = globalPos - llGetRegionCorner();
with global Pos the value copied from above.

if this proves to work, a version with the target region as argument name will be added, doing that math for us.
2017-06-26 03:24   
(edited on: 2017-06-28 16:23)
Please, keep in mind.

If new functions are added to opensim but are not added to the opensim wiki, then many users ignore their existence and how they work.

In this case, creating new function loses much of its interest ...

Call for Volunteers

osObjectTeleport @ [^]

Tank you in advance.