Godot Version 4.2
Question: Why would a CollisionShape not Move with the Parent RigidBody? How do I fix this error?
After completing the tutorial “Your First Game” I wanted to try and make something simple, like Pong. Everything behaved as expected until I put everything together and… the ball simply went through the paddles.
I doublechecked
- The paddle’s (Area2D) Monitoring property is on.
- The paddle and ball (RigidBody2d) are on the same collision layer
- Signals were properly connected
But I wasn’t getting any hits registered, and the ball was still moving through the paddle. In an attempt to get a better look at the problem, I allowed the paddle to move horizontally and discovered that the ball changes directions when the paddle moves through the center of the screen (where the ball originates at the start of the game):
And then:
In response to that, I attempted to ensure that the collision shape would follow the RigidBody object (the Ball) with the following statement:
$CollisionShape2D.position = position
in the script attached to the Ball object, which set the position of the collision shape equal to the position of the parent node. However, when I tested those changes, the ball didn’t move… adjusting the RigidBody’s mass properties (increasing mass) and changing the sleep mode of the collider made the ball vibrate intensely while remaining in place… leading me to believe the RigidBody was colliding with it’s child CollisionShape.
I have no idea what is going on, please send help
(On a serious note I will reply to any questions ASAP with more info)
I would appreciate your time and help, thank you