- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4
 
Open
Description
Hi :) I think there might be something wrong with the maths of rotation conversions. Perhaps I also made a mistake. This is the suspicious code:
My goal is to convert a Matrix4 from Euler rotation.
This code works for me:
  const quat = createSomeEuler(eulerDegrees).getQuaternion();
  return new Matrix4().identity().fromQuaternion(quat);But this code does not work for me (but it would be preferable because it's likely more performant):
  const matrix = new Matrix4().identity();
  createSomeEuler(eulerDegrees).getRotationMatrix(matrix);
  return matrix;Shouldn't they be equivalent? The objects appear at the wrong position when using the second snippet. I didn't check the matrix values. Or did I make a mistake?
I checked the source of getRotationMatrix, and it writes 16 values, so I assume using Matrix4 is correct.
My euler construction look like this:
  const x = degreesToRadians(eulerDegrees[0]);
  const y = degreesToRadians(eulerDegrees[1]);
  const z = degreesToRadians(eulerDegrees[2]);
  const order = Euler.ZYX;
  return new Euler(z, y, x, order)Metadata
Metadata
Assignees
Labels
No labels