You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Collision detection between a moving rigid body and a kinematic body that uses move_and_collide() will fail to detect a collision if they both move towards the same position on the same frame. See also #46601 for collision detection between two moving kinematic bodies.
Steps to reproduce:
Create a rigid body that will move towards the origin at 1 unit per a frame (vel=60 at 60Hz physics loop). Position it at x=-60 so at the end of physics frame 60 it will be positioned at the origin.
Create a kinematic body that is positioned next to the origin. On frame 60 use move_and_collide() such that it will overlap the rigid body at the origin.
Notice that no collision is detected by the kinematic body, and the rigid body does not react to the kinematic body and ends up overlapping it.
I don't think this is a bug after all, instead it's a result of the update order of rigid bodies.
Rigid body positions updated
_physics_process() called for nodes
So rigid bodies _physics_process() essential operates on a 1-frame delay. So in the example provided, the kinematic body moves on frame n and sees no collision (because the rigid body is not there yet). The rigid body is stopped on frame n+1 and since its position gets updated at the start of the frame before _physics_process() is called, that's why it ends up being stopped on the kinematic body without the kinematic body seeing a collision.
Godot version:
3.2.3.stable
OS/device including version:
N/A
Issue description:
Collision detection between a moving rigid body and a kinematic body that uses
move_and_collide()
will fail to detect a collision if they both move towards the same position on the same frame. See also #46601 for collision detection between two moving kinematic bodies.Steps to reproduce:
x=-60
so at the end of physics frame 60 it will be positioned at the origin.move_and_collide()
such that it will overlap the rigid body at the origin.Minimal reproduction project:
test-rigid-kinematic-collision.zip
The text was updated successfully, but these errors were encountered: