Unable to apply rotation to a Bone, but its TransformNode works

Hi, I’m importing a GLTF from Ready Player Me. I want to rotate the head based on the rotation of the WebXRCamera.

If I find the “Head” bone and apply the rotation to it, nothing happens. I tried modifying rotation directly and with setRotation (throws an error) and rotate. In the inspector, I can’t modify its rotation either. Adding a gizmo with the inspector works though.

If instead, I find the “Head” TransformNode that’s attached to the bone, it does work in code and in the inspector. I’m applying Euler rotations, so I set rotationQuaternion to null which is something I’m unable to do with the bone as I get an error.

I don’t get the errors and why some cases are not working. I’d love to understand it, thank you!

As it is a gltf the bone are associated to a transformNode “driving” them: https://playground.babylonjs.com/#1YAIO7#500

2 Likes

Thanks for the reply! So this is specific to GLTFs? How do I know whether to modify the bone or the TransformNode with other importers?

modify the transformNode if not null, the bone otherwise :slight_smile: This should cover all cases.

1 Like

Cool, thank you so much!