• RuntimesGodot
  • How do you make the physics constraint to ignore its parent's movement?

My requirement is similar to these posts:
https://esotericsoftware.com/forum/d/27948-how-to-disable-spine-physics-when-interacting-in-unity
https://esotericsoftware.com/forum/d/25523-physics-related-question--separate-gameobject-transform-from-skeleton-bones-/2

But in spine-godot GDExtension, i can't seem to find such function to separate physics constraints from certain parents.

To be exact, i have a pseudo-3D scene in Spine, where there's a "camera bone" controls a parallax effect for every object in the scene, including a character with physics constrains applied to their hair.
When i move the camera bone, i don't want their hair to swing, instead i need the physics constraints to only be affected by the character itself.

Can i achive this in the Spine editor? if not yet, is it possible to code it at the runtime in Godot?

Related Discussions
...

In the spine-godot runtime, you can achieve the effect of having physics constraints ignore the movement of a parent bone by manipulating the bone transforms at runtime. Since you want the physics constraints to be affected only by the character and not by the camera bone, you can adjust the world transform of the bones involved in the physics constraints after the camera bone has moved.

To do this, you can use the SpineSprite node's signals to intervene at the right moment. Specifically, you can connect to the before_world_transforms_change signal to adjust the local transforms of the bones with physics constraints before the world transforms are updated. This way, you can counteract the movement introduced by the camera bone.

Here's a general approach you can take:

  1. Connect to the before_world_transforms_change signal of your SpineSprite.
  2. In the signal handler, adjust the local transform of the bones with physics constraints to negate the effect of the camera bone's movement.
  3. Allow the world transforms to be updated normally, which will now reflect the desired behavior.

This approach allows you to programmatically control how the physics constraints are applied, ensuring they are only influenced by the character's movement and not by the camera bone.

You can do it in the editor. The physics constraint sees the changes in the world transform since last time it was applied and it causes the bones to "lag" behind, then catch up using forces. When you move your camera bone, it affects the physics constrained bone. When all the constraints are applied, the camera bone movement affects physics -- not what you want.

The trick is to use a transform constraint where the camera bone X and Y translation is constrained and the target bone is what actually moves the camera. Next, place the transform constraint in the constraint order so it happens after the physics constraint (ie place it lower).

This way the world transforms are computed, but the camera bone hasn't moved yet, then the constraints are applied. The physics constraint is applied first, so it sees the world transforms at that time, before the camera bone moves. Later in the constraint order the camera is moved by the transform constraint, but the physics constraint never sees that movement.

  • kBlankii님이 이에 답장했습니다.
  • kBlankii 님이 이 게시물을 좋아합니다..

    Nate It worked like a charm! thank you!

    • Nate 님이 이 게시물을 좋아합니다..