- Home /
Why two "RotateAround" calls around transform.right and transform.up results in slight rotations also in the Z axis?
Hi,
I don't know why these two consecutive rotateAround calls give me small unwanted rotations in the Z axis:
transform.RotateAround (objetivo.position, objetivo.transform.right, input_eje_y);
transform.RotateAround (objetivo.position, objetivo.transform.up, input_eje_x);
if I comment out any of them, i get the correct rotation around the proper axis. Can somebody please help me to understand what's going on here?
BIG thanks in advance!
Answer by Aralox · Dec 11, 2011 at 11:53 PM
Im guessing that something about the way Unity implements the total rotation involves a simplification of the two rotations, which involves floating point numbers.
Floating point numbers are notorious for being inaccurate, see here and here.
As for preventing/correcting this problem, I think there are many different solutions, but a simple one might be to convert your angle to an int before rotating.
Good luck!
Your answer
Follow this Question
Related Questions
rotate around character 1 Answer
Transform.RotateAround over specific length of time 1 Answer
rotate around character 2 Answers
Snap the rotation of object 2 Answers
How do I rotate an object around another to have its opposite ? 0 Answers