Reputation: 35
Please help.
My camera orientation on 3D max is:
90 -30 0
When I export to X3D file it will have this orientation:
0, 0, -1, -0.524
And I can easily convert this to the angle of the camera on the z axis like this:
-1 * -0.524 * 180/Math.PI = 30;
Problem:
But when I rotate the camera on 3D max to:
90 -30 90
on X3D I get this vector:
-0.251, 0.935, -0.251,-1.638
How can I figure out the value of z angle?
Upvotes: 0
Views: 266
Reputation: 35
Found a way to do it in Stage3D, probably the same on other platforms:
first you create an empty matrix3D:
var m3d:Matrix3D = new Matrix3D();
then you rotate it with the given orientation vector from the X3D file:
m3d.appendRotation(v.w*180/Math.PI,new Vector3D(v.x,v.y,v.z));
decompose the matrix
var angles:Vector3D = m3d.decompose("eulerAngles")[1];
you get xyz angles in radians so turn radians to degrees:
var _z:Number = angles.z*180/Math.PI;
Upvotes: 1