Attach objects to (animated) bones, like weapon in character’s hand, by ExposeTransforms

Posted on

Zrzut ekranu z 2020-10-09 00-47-16
Zrzut ekranu z 2020-10-09 00-46-42
Zrzut ekranu z 2020-10-02 02-42-19
Zrzut ekranu z 2020-10-09 02-17-05

You can now easily attach objects to (animated) bones in your models, e.g. to attach a weapon to animated character’s hand.

This is performed by setting the TCastleSceneCore.ExposeTransforms property. It allows to “expose” transform nodes within a TCastleScene. Transform node is TTransformNode, which in particular represents “bones” animated by glTF and Spine. “Expose” means that we create children TCastleTransform instances, which follow these bones. Subsequently, you can place new scenes inside these children, e.g. add weapons to the hand bone.

It is all nicely visual, ExposeTransforms can be set in the CGE editor using a comfortable dialog box. The children transforms are automatically created and named.

You can also use ExposeTransformsPrefix to avoid name collisions.

See the example application examples/animations/expose_transformations_to_animate_children.

Start the discussion at Castle Game Engine Forum