Joint / bone controlled mesh animation

Is there currently any mechanism to animate a skinned model by programmatically updating bone joint angles?

My interest would be to e.g. implement inverse kinematics for accurate walking animation based on foot placement, and other complex behaviours which cannot be achieved by stored animation. And also mechanisms to allow skins to be switched but motion controllable with a unified interface.

I imagine this would require GPU implementation to move the mesh vertices according to the bone transformations, and realistically deform the mesh near joints, maintaining volume etc.

Indeed, in short – it’s not ready yet, and it will be done by making glTF skinned animation on GPU. This is mentioned on our roadmap Roadmap | Castle Game Engine (" Load and animate glTF more efficiently"). It’s quite important for me, and will definitely happen in 2022, I hope in Q2 of 2022.

Longer description: We have 2 approaches to skinned animation in CGE.

  1. glTF skinned animation. This is a modern approach that can be very efficient, and such animation can be exported e.g. from Blender->glTF already.

    Our current implementation is poor: we actually “bake” the animation (converting bone movement into final mesh states) when loading. This “baking” was done because it was the simpler way to implement it originally… but is problematic, it consumes memory, consumes loading time, and prevents you from being able to move bones by code at runtime. I.e. you can move the bones by code at runtime, but right now it will not affect the mesh.

    So we want to improve this glTF skinned animation handling :slight_smile:

  2. There is another approach to skinned animation using H-Anim: H-Anim component | Castle Game Engine . The result of bone movement is calculated at runtime in this case, so basically it actually has the feature you ask for. However…

    The current implementation applies bones on CPU, not GPU, and it thus quite slow, there’s a noticeable overhead at runtime.

    Moreover, H-Anim didn’t get much support. Blender, 3ds Max, Maya – they cannot export to a skinned animation using H-Anim, from what I know.

    So I don’t really plan to extend this path in CGE.

1 Like

Brilliant! So do you think the glTF skinned animation will be ready around the end of June, say?

Yes. I mean around the end of June 2022, it will be in the version where it is performed on GPU and the bones can be moved from code (and affect the skin properly).

The glTF skinned animation itself (without above features) works already, i.e. skinned animation that you just design in e.g. Blender and export to glTF works OK already :slight_smile:


I’m just a beginner in 3D animation, but just so I understand:

Would this mean you could have a ‘Head’ bone on the player’s model, and then get the head to look around the level - eg. rotate 30 degrees left, or rotate 10 degrees up, so it looks like the player is looking around the level when you come close to different points of interest? Like looking down a hole, or at a treasure chest?

If so, I think that would be a very cool feature! :grinning:

Yes, exactly. This will be possible – you will be able to rotate the head bone at runtime to look at any desired point.

1 Like

Thank you! That sounds like it’ll be a really fun feature to use! :grinning: