Setting rotation quaternion to [0, 1, 0, 0] leads to the bone keep flipping 180 degrees

Hi everyone, I try to rotate a bone to [0, 1, 0] direction (pointing to the sky) so that I can apply the join orientation from Kinect, which rotates the join from [0, 1, 0] direction. However, when I use

upperArmBone.setRotationQuaternion(new BABYLON.Quaternion(0, 1, 0, 0), BABYLON.Space.WORLD),

although the bone is pointing to the sky, it keeps rotating 180 degrees around vector [0, 1, 0]. Can anyone please give some advice?

The playground associated to this issue is as follow:

https://playground.babylonjs.com/#BCU1XR#3784

Thank you.

Hi!

First, I assume you don’t mean a quaternion in those values, but a quaternion built from those euler angels (similar to the way you are doing in the playground you shared).

Is there a reason you want to use WORLD space instead of LOCAL space for the bone?

1 Like

Hi RaananW,

The reason I would like to use WORLD space is because, based my understanding, the joint orientation quaternion from Kinect always refers to the posture when the joint points to the sky ([0, 1, 0]) in WORLD space. So I would like to turn the bone in babylon to the same direction before applying the Kinect join orientation.

Do you have any idea how to fix my issue so that the bone’s direction in WORLD space is [0, 1, 0] without flipping? Or maybe, by any change, you know how to apply Kinect’s joint orientation to control babylon’s bones.

Thank you

@RaananW I remember we talked about this on chat a while ago, do you remember if we found any solution? Or should I create an issue so we can keep track of this? :smiley:

1 Like

Oh, let’s create an issue for this. it still needs to be investigated.

1 Like

Created! Setting bone rotation to (0,0,0) leads to bone flipping on every frame · Issue #11708 · BabylonJS/Babylon.js (github.com)

1 Like

Let me take a look.

PR in review

2 Likes