Search the Community
Showing results for tags 'euler angle'.
-
Hey all, I've been playing a bit with quaternions to rotate meshes but I also need to use Euler angles. The quaternions are great for my internal cooking because (imo) they are easier to use and more versatile than Euler angles, but Euler angles are good for UI, it speaks to people (especially if we convert everything into degrees (the audience of the app is neuroscience researchers, so they would probably think quaternions are black magic). The BJS doc says "once you have used a quaternion, the rotation property of a mesh become null and basically no longer usable". Fortunately, we can have user think they set the rotation with a Euler angle but internally convert in into a quaternion. Unfortunately, I think I went into a bug. Here is what I have: // this._planeSystem is a mesh composed of 3 orthogonal planes let currentQuaternion = BABYLON.Quaternion.FromRotationMatrix( this._planeSystem.computeWorldMatrix(true) ) let eulerAngle = currentQuaternion.toEulerAngles() let someQuaternion = eulerAngle.toQuaternion() /* I expected currentQuaternion to be the same as someQuaternion (with possibly some epsylon) but instead, here is what I have: */ currentQuaternion { w: 0.9987502633525326, x: 0.04997916777685541, y: 0, z: -1.1097604563493715e-17 } eulerAngle { x: 0.09999999729822372, y: -1.1148677691588498e-18, z: -2.2278771887960178e-17 } someQuaternion { w: 0.9987502604624825, x: -5.56737237414314e-19, y: -2.786008172251712e-20, z: 0.04997916792147843 } /* I am not sure if it's toEulerAngles() or toEulerAngles() which is in fault but it looks like someQuaternion.z should have been someQuaternion.x */ I'm not sure, but looking at the source, it looks like you plan on giving the choice of the order. Do you confirm it's a bug? Cheers, Jonathan.
- 7 replies
-
- quaternion
- euler angle
-
(and 1 more)
Tagged with: