I have two RigidBody2Ds - player and the ball. I need them to be RigidBody2Ds because I rely on the godot's physics engine to handle collisions/bounces/rotations and so on.
However, there's one thing I want to control manually - I want to set ball's velocity RIGHT AFTER the collision with the player. Generally, it's not a problem to detect a collision (I can use
body_exited signals or contact monitor) and setting ball's velocity (I can do it using
The problem is no matter what combination of those methods I use I can't sync it with the physics engine. There's a noticeable jitter when ball's velocity is high because the velocity is set one physics frame after the collision. This is what velocity looks like when printed out in
- Velocity before collision
- Velocity after collision, calculated by the engine
- Velocity that I actually want to set
Is there any way to tackle it?
EDIT: I want collisions between player and ball to work as usual but let the player control the direction and speed of the ball with a kick whenever he wants.