Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

threejs rotation by x and z works individually but fails together

Tags:

three.js

webgl

I need to rotate the diamonds (see attachement) around the x and z axis. When rotating individually (meaning I only set rotation.x or rotation.z) the rotation looks fine and it works. But when I set both the rotations (x AND z) the rotation looks like this:

diamond rotation fail

Do I miss something? Is somehow the object local coordinate system rotated and now rotation around 2 axes fail?

diamond.position = brilliantPositions[i][0];
diamond.rotation = brilliantPositions[i][1];
this.frames.arrangementMesh.add(diamond);

Thanks in advance for a hint Kind regards Roman and Patrick

like image 253
Doidel Avatar asked May 21 '13 17:05

Doidel


1 Answers

The euler order indeed solved the problem for us. In our case we had to do the follwing

diamond.eulerOrder = 'ZYX';

in order to have the calculation take the right way. Many thanks!

Here's more information about euler order

PS: I couldn't accept the comment as answer WestLangley therefore I just upped it and reposted the solution here

like image 131
Doidel Avatar answered Nov 15 '22 03:11

Doidel