BoneLookController has no impact on running animation

Hi!

I’m trying to move the head of an animated character towards a sphere (by BoneLookController), but I can’t figure out why this does not work on my gltf file:

https://www.babylonjs-playground.com/#1B1PUZ#60

I simply edited this demo scene where it worked with a babylon file:
https://www.babylonjs-playground.com/#1B1PUZ#15

Does anyone have a hint for me how to get this to work? Thanks!

Unfortunately, gltf midels are not compatible with bone controllers. I wrote the controllers before gltf was implemented in bjs.

Oh okay, thank you for your answer!

Is there still a possibility to override parameters (e.g. the rotation of a bone) which are already set by a running animation? Currently, every change of the rotation will be directly overwritten by the walk animation…

Here is my working implementation without the BoneLookController if someone also struggle with this:
https://www.babylonjs-playground.com/#1B1PUZ#65

To get this to work, I removed the keyframes of the walk animation for the head bone from the gltf-file (so I can apply my own rotation via code) and calculated the direction with the given functions in the Matrix and Quaternion classes by my own. I also implemented a little state machine to fade between “following” and “initial” to avoid highly unreasonable rotations.

1 Like

gltf bones work by attaching each bone to a transformNode. So to control a bone you actually need to control the source node.

This is why BoneLookController does not work with skeletons loaded from gltf :slight_smile:

It appears that @AndreM is controlling the bone and not the source node in this PG:

https://www.babylonjs-playground.com/#1B1PUZ#65

I see. It’s weird, though, that the bonelookcontroller isn’t working now that there is no animation on the head.

it works because there is no more animation to overwrite it

yet bonelookcontroller doesn’t work when there is no animation

This is how it works: Babylon.js/skeleton.ts at master · BabylonJS/Babylon.js · GitHub

Hi, sorry to bump - how would one use the transformNode in order to achieve the BoneLookController functionality? I can’t get AndreM’s solution to work.