constraints now affect velocity

This commit is contained in:
Sara 2023-10-24 23:50:10 +02:00
parent f8462d8e2c
commit 081be0a0f1

View file

@ -78,6 +78,10 @@ void physics_entity_solve_contacts(PhysicsEntity self, List* contacts) {
if(iteration == 1)
LOG_WARNING("gave up on solving %zu contacts", contacts->len);
}
Vector dir = vnormalizedf(vsubf(rigidbody_get_transform(body)->position, pre_solve.position));
Vector vel = rigidbody_get_velocity(body);
vel = vsubf(vel, vprojectf(dir, vel));
rigidbody_set_velocity(body, vel);
}
void physics_entity_update(PhysicsEntity self) {