world Units and Angles Problem
could anyone pleas explain to me how I can read out rotationangles of objects in worldspace?
Example: I have a cannon and tilt it up 45 degrees. If I read out the Transform of my cannon, I get a radians for that x-rotation... strange though that I am not able to translate that radians into a readable Angle in degrees... I end up with 21 degrees whereas it should be 45 degrees.
here is my simple testcode..
In the end I am trying to calculate a parable of a thrown object, and the equation for that problem needs correct angles. Any help is deeply apprecciated.
// -----JS CODE-----
//@input SceneObject myObject
var transform = script.myObject.getTransform();
var currentRot = transform.getWorldRotation();
// Convert radians to degrees
var degrees = currentRot.x * 180 / Math.PI;
print("Angle:" + currentRot.x); // gives me the quat
print("Angle in degrees:" + degrees); // should give me the degree
The getWorldRotation function returns a quaternion rather than Euler angles. Lens Studio has a built-in functions to convert between the two.