constraints now affect velocity
This commit is contained in:
parent
f8462d8e2c
commit
081be0a0f1
|
@ -78,6 +78,10 @@ void physics_entity_solve_contacts(PhysicsEntity self, List* contacts) {
|
||||||
if(iteration == 1)
|
if(iteration == 1)
|
||||||
LOG_WARNING("gave up on solving %zu contacts", contacts->len);
|
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) {
|
void physics_entity_update(PhysicsEntity self) {
|
||||||
|
|
Loading…
Reference in a new issue