xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

Euler angles in model rotation does not work as expected

Open hamza-hajji opened this issue 4 months ago • 10 comments

Describe the bug

Changing rotation coordinates does not work as expected, this visualization describes how euler angles work

https://danceswithcode.net/engineeringnotes/rotations_in_3d/demo3D/rotations_in_3d_tool.html

If I try the same thing in xeokit, I get very different results

To Reproduce Steps to reproduce the behavior:

  1. Go to an example model https://xeokit.github.io/xeokit-sdk/examples/buildings/#xkt_vbo_Duplex
  2. change the x and y coordinates
const model = viewer.scene.models.myModel
// [pitch, yaw, roll]
model.rotation = [30, 90, 0]

image

Notice how the x and y rotations are always local to the object's axes

Expected behavior

I expect the rotation to work like this visualization of euler angles (yaw being y axis, x being pitch)

image

I'm not sure how xeokit calculates rotation, if anyone can provide me with a way to make the object's rotation global instead of local that would be appreciated

Thank you

hamza-hajji avatar Oct 07 '24 12:10 hamza-hajji