Fix multiple issues with one-way collisions
For RigidBodies, uses the collision normal determined by relative motion to determine whether or not a one-way collision has occurred. For KinematicBodies, performs additional checks to ensure a one-way collision has occurred, and averages the recovery step over all collision shapes. Co-authored-by: Sergej Gureev <sergej.gureev@relex.fi>
This commit is contained in:
@ -645,7 +645,7 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
|
||||
Vector3 a = sr[k * 2 + 0];
|
||||
Vector3 b = sr[k * 2 + 1];
|
||||
|
||||
recover_motion += (b - a) * 0.4;
|
||||
recover_motion += (b - a) / cbk.amount;
|
||||
|
||||
float depth = a.distance_to(b);
|
||||
if (depth > result.collision_depth) {
|
||||
@ -791,7 +791,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
|
||||
|
||||
Vector3 a = sr[i * 2 + 0];
|
||||
Vector3 b = sr[i * 2 + 1];
|
||||
recover_motion += (b - a) * 0.4;
|
||||
recover_motion += (b - a) / cbk.amount;
|
||||
}
|
||||
|
||||
if (recover_motion == Vector3()) {
|
||||
|
||||
Reference in New Issue
Block a user