Can't .getBoneByName on imported character

I’ve loaded a skinned character and I can’t reference its Hip bone with the .getBoneByName method.
Does this method only works for Threejs generated skeletons?

Regards

It should work for all 3D objects assuming Object3D.name is correctly set. Are you able to share your asset in this topic?

Hi Mugen, thank you for the reply, I’ve put the asset in this repo

I set the call in the loader like so:

loader.load(
MODEL_PATH,
function(gltf) {
let model = gltf.scene
let fileAnimations = gltf.animations
let hip = model.getBoneByName(‘Hip’)

})

but then get a TypeError: model.getBoneByName is not a function

Ah wait. getBoneByName() only exists on a skeleton object. Please try it like so:

let hip = model.getObjectByName('Hip');

Ok this works indeed. I tried it earlier but didn’t see any result because an animation was applied… :roll_eyes:
Thank you for the confirmation!

However I guess it would be possible to apply the same directly to a .clipAction by splicing the Hip.quaternion or something like that…?

Do you mind explaining in more detail what you mean? I mean getObjectByName() will just return you the bone. Extracting animation data from keyframe tracks seems to be a different thing.

What I’m trying to achive is to add for instance 90° to the Hip while the animation is running.

Like the possibility in Maya to set an additive animation layer to the base anim’

Because .splice won’t work for me this way since it removes all keyframes on the spliced bone(s).
I hope I make sens.

Okay, thanks for the additional details. three.js supports additive animation (https://threejs.org/examples/webgl_animation_skinning_additive_blending) but it only works if you encode the transformation in a clip and make it additive. The code from the example might help in implementing this.

Yes! I see the .makeClipAdditive part and will give it a try. Thanks a lot Mugen!