0

I have rotating cube which I rotate 90° on the x,y or z-axis. After a rotation is finished I want to reset the rotation by simply setting:

cube.rotation.x = 0;
cube.rotation.y = 0;
cube.rotation.z = 0;

But when this is done the x,y,z-axis of the cube are not reset (An axishelper shows me). In addition to that the cube is then slightly tilted. I set up a JsFiddle to show this behaviour: http://jsfiddle.net/mikel/an86j/23/

Why is that so?

  • Now I also tried to remove the cube after the animation and create a new cube. The same result. – Michael Perlbach Feb 18 '13 at 20:27
  • So, after some further digging I realize that it's not possible to reset the cube's rotation (http://stackoverflow.com/questions/14774633/how-to-rotate-an-object-and-reset-its-rotation-to-zero). BUT: What comes as a bad surprise to me is that the cube and the axis still have the wrong angle and the cube is still tilted even when I completely clear the scene and rebuild it then. Maybe someone has at least an explanation for this. Thank you. – Michael Perlbach Feb 19 '13 at 09:34
  • Can you add code showing how you clear and rebuild? There must be some refs still around for this to happen. – Neil Feb 19 '13 at 14:03
  • Finally I solved it. The problem was that one rotation function still continued to rotate the cube after it was newly created. As a result the cube was tilted. With the help of a flag I was able to stop this. – Michael Perlbach Apr 19 '13 at 05:34

0 Answers0