Animating body is changing child of child's position for no reason.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PedroMoniz

I am creating a simple scenario where I have a camera with a body inside that has a position2d inside it.

Camera2d
-KinematicBody
–Position2d

I want to move the camera via an animation, think of it as an “on-rails game”. The animationPlayer will control the entire level.

When the camera position changes, the kbody also changes and everything is good and makes sense.

However, the Position2D inside the kbody starts to move as well instead of staying in relation to the kbody. It ends up moving twice as fast which makes no sense at all to me.

How do I solve this problem? Does it have to do with a kinematic body being moved via animation at the same time?

:bust_in_silhouette: Reply From: PedroMoniz

So I fixed it and it looks like the system has a bug in the calculations for the global position.

I was spawning an item on the Position2D global position.

I changed it to:
self.position + $PositionForward.position

And everything now works perfectly.