Is there no MyAvatar.position?


Where looking on the new docs site, but i cannot find a command to get the position your avatar is. i would call it MyAvatar.position. It usefull to read the coordinates where your avatar is staying.

Is that command not implemented or just not on the docs site ?


:frowning: on the wiki only found this line Vec3 MyAvatar.position so the command is available put need to be addded on the new docs site (like so many others :open_mouth: So sorry for asking.


The script currentAPI.js is useful: it lists pretty much all of the current JavaScript API.


Where is the wiki and docs site you mention?



Note: MyAvatar.position can not be relied on to give the correct position every time . Specifically, when the avi is in motion, it will often report the last frame’s position.

The effect of this can be seen here:

The bug is caused by Interface / JS thread timing issues, and according to the devs may not be possible to fix…

Sorry to be the guy with the bad news!

  • davedub


I use in my places.js:
var pos2 = {x:1057.7, y:162.8, z:965.4, rx: 0.0,ry:0.966, rz: 0.0,w:0.0, p:“pose1” } ;
var posi={ x: pos2.x,y: pos2.y,z: pos2.z};
var rosi={ x: pos2.rx,y: pos2.ry,z: pos2.rz};

It dos work well. I use it for teleporting to different places at my island, where I also active the pose, which I want for this place.


The function is supposed to be print out “MyAvatar goToLocation - moving to” and used mainly with location and rotation with the vec3, bool, quat). Setting the position directly is also possible since Javascript doesnt really have private/public methods.

If it doesnt print this out it means the script interface might have a bug (it has happened before with getting bone velocities, so it can also happen with the setters)