- Home /
Inverse of Quaternion.eulerAngles?
Hi Guys
Simple question that I'm struggling to find an answer to. The function of Quaternion.eulerAngles is to return an angle representation of a quaternion, is there an inverse to this function? To Return a quaternion from a transform.eulerangles representation?
I have a object which can only be rotated using the function transform.eulerAngles and I need to use the continuous euler angle readings to produce a quaternion to drive other objects.
Thanks in advance for any help.
Answer by LessThanEpic · Jan 23, 2015 at 09:33 PM
I'm a little unclear on what you're asking, but it sounds like you want Quaternion.Euler. It takes in the x, y, and z rotations and returns the quaternion representation.
The trick to using Quat.Euler is to forget transform.eulerAngles (they can jump around on you.) Ins$$anonymous$$d, make your personal variables for the x,y,z angles. Change those however you like, and each frame set rotation=Quat.EA(x,y,z)`.
Thanks for the instant response guys. Basically I have a GUI which rotates based on touch using the transform.eulerAngles function. The Gui object is then intended to rotate another object but with a different speed but still based on rotation of GUI. I cannot continue to use transform.eulerAngles on the other object because it would exceed 360 deg.
Can rotation=quat.EA still be applied in this case Owen? If so can an angle reference be used in it?
I'm a bit of a rookie with this one still. Thanks
Your answer
Follow this Question
Related Questions
local rotation per axis between frames? 1 Answer
How to use quaternions to apply an offset to a rotation to calibrate a controller 1 Answer
Quaternions; how do I rotate an object around only 2 axis based on another rotation? 1 Answer
How can I instantiate a gameobject facing another gameobject 2D? 0 Answers
Object deforms with rotation 1 Answer