Bug animating nested AnimatableBody3Ds

Godot Version

4.1.2

Question

The goal is to be able to animate multiple AnimatableBody3Ds that are nested inside each other. For this example, think of a billfold at a restaurant, it has 2 hinges, with 3 different faces that rotate 90 degrees (see left image):

editor_vs_game_gif

Problem
This works fine in the editor, but in the game each piece ignores the movement of its parent, so the origin (hinge/pivot point) stays fixed, and the rotation animation appears to stack (Root/A rotates 90 degrees, Branch/B rotates 180, Leaf/C rotates 270 degrees (see right image above).

Node Hierarchy:

Root
    Branch
        Leaf

I have tried multiple approaches, using tweens and using AnimationPlayer.

It works fine if A, B, C are just MeshInstance3Ds, but I need AnimatableBody3Ds for collisions.

Using AnimatableBody3D has issues - I can get it to sometimes move correctly using a tween for each of the parts but this has 2 problems: 1) the CollisionShape3D does not follow the mesh, remaining where it started. 2) If the tweens are not started and stopped at the exact same time, each face gets out of sync, and the pivot point can start to drift.

Is this a bug or is my strategy flawed?

It seems to be broken if AnimatableBody3D.sync_to_physics is enabled. Open an issue here Issues · godotengine/godot · GitHub explaining what you want to achieve and what the problem is and try to attach a minimum reproduction project too so people can easy test it.

Thanks! I’m not sure what changes when sync to physics is off, but it appears to work fine.

I found an existing issue already open that includes an MRP and is essentially the same issue:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.