Invert position of CollisionShape3D

Godot Version

4.6

Question

Hi everyone!

I’m trying to invert the position of a AnimatableBody3D (also other 3D nodes) when the player flips their facing side in x axis. For example, when punching, I have the position of the hitbox and hurtbox in the track of AnimationPlayer.

When I flip the character, I was inverting its scale (scale.x * -1), but I guess this comes with some issues for 3d objects and collision. What would be proper way to invert the position of these nodes? Should I remove the track from AnimationPlayer and place the collision shape position by code? Note that the HitBoxCollision is a child of HitBox, so when I was inverting the scale, the HitBoxCollision moved to the other side

Add it as a child of the Bone3D you are animating. It will move with it when it is animated or the player is flipped and you don’'t have to do anything.

1 Like