- Home /
Quaternions and EulerAngles
Hey,
I asked a similar question before, but since it didn't get answered and I condensed the problem down to something completely different, here's the new question.
I have a given transform, that I rotate to using
transform.rotation = desiredRot;
Now what I want to do is keep the same functionality, but using
transform.Rotate();
How can I achieve this?
Yes, I read the documentation. transform.rotate(desiredRot.eulerAngles);
doesn't do the job however, and I don't quite know how to use it differently. A clue would be nice.
Assigning a Quaternion is an absolute rotation. Transform.Rotate() is a relative rotation. Off the top of my head without any testing, you should be able to do something like:
trnasform.rotation = Quaternion.identity;
transform.Rotate(desiredRot.eulerAngles);
Or you could replace the first line with:
transform.eulerAngles = Vector3.zero;
Of course if you are going to use transform.Rotate this way, you might as well just assign the euler anges of the Quaternion to Transform.eulerAngles.
FTR there are good beginner articles on quaternions here unityGE$$anonymous$$S.com
Your answer
Follow this Question
Related Questions
Transform.Rotate producing unexpected results when being used after setting localEulerAngles 0 Answers
transform.forward wobbles about instead of rolling 1 Answer
Rotate Object Around Local X Axis , then Local Y Axis, then Local Z Axis (like a turtle) 0 Answers
Rotation changing in untouched axis 1 Answer