Prevent drag forces from causing something to come to a complete stop

This commit is contained in:
Ludvig Böklin 2021-04-21 16:07:24 +02:00
parent b10718c568
commit 6e364665cb

View File

@ -86,7 +86,9 @@ fn integrate_forces(
// This way we can only ever lose velocity and will never experience a reverse
// in direction from events such as falling into water at high velocities.
if new_v.dot(vel.0) < 0.0 {
vel.0 -= vel.0.projected(&impulse);
// Multiply by a factor to prevent full stop, as this can cause things to get
// stuck in high-density medium
vel.0 -= vel.0.projected(&impulse) * 0.7;
} else {
vel.0 = new_v;
}