Problems with MyAvatar.orientation


I set the MyAvatar.orientation with:

avatarOrientation = MyAvatar.orientation;

The x and z orientation I can set from -1 to 1. The y orientation only from -0.7 to 0.7. So full 360 degrees are not possible. I use this in my script for the direction, where I want to go. So I can’t go in all directions.


Isn’t the orientation a Quaternion?

So it would contain w,x,y,z, (which is same as real, i, j, k) as far as I remember when I looked at it) so modifying just the z orientation without adjusts the real value (w), it would always go to -0.7 or +0.7 (-90,90 euler y). This apparently is because a Unit Quaternion has to always equal to 1.

Best way is just to convert the orientation to Euler ,add to that, and then return it as a Quaternion. That is unless you know the math.


Thanks for remembering me at the Quaternions. And yes finally this works :smile:

var avo = Quat.safeEulerAngles(MyAvatar.orientation);
MyAvatar.orientation=Quat.fromVec3Degrees( avo );

So the next problem is, to let the avatar really go in the right direction.