added epsilon value to linear constraint check

This commit is contained in:
Sara 2023-11-02 18:11:34 +01:00
parent 0704378f1a
commit 1a822754b3

View file

@ -45,7 +45,7 @@ int _internal_default_contact_solver(RigidBody* body, Contact* contact, Transfor
Transform* trans = rigidbody_get_transform(body);
const Vector world_collision_point = vaddf(transform_point(&pre_solve, hit.point), hit.penetration_vector);
const float current_dot = vdotf(hit.normal, vsubf(transform_point(trans, hit.point), world_collision_point));
if(current_dot >= 0.0)
if(current_dot >= -0.0001)
return 1;
// the desired position is anywhere the overlapping vertex is further along the normal than the contact point
const Vector target = vaddf(trans->position, vmulff(hit.normal, -current_dot));