nadeem
nadeem

Reputation: 43

Rotation in three js is not correct

I am trying to rotate mesh with three.js. I have set euler order "ZXY". Now if I rotate X 90 degree and apply Y or Z rotation it shows the same result. While i am thinking the result on rotation Y and Z should be different.

This situation is termed as gimbal lock. You can produce this problem easily on three.js online editor

http://threejs.org/editor/

put 1.570 in the Z rotation and then change rotations values in Y and X. You can see both will produce the same output, that should not happen in the application.

Upvotes: 2

Views: 679

Answers (1)

ObiWanBennobi
ObiWanBennobi

Reputation: 128

What you are dealing with is known as the gimbal lock. It happens when you use euler angles. Since euler angle representations are ambiguous, many euler triples may result in the same rotation. Important is the order in wich the 3 angles x,y and z are applied. for example: rotating 90 deg. around x equals rotating 180 deg around y and then -90 deg around x. to avoid this, use quaternions for rotations.

Upvotes: 2

Related Questions