]> git.tdb.fi Git - libs/game.git/commitdiff
Use the correct inertial quantity for calculating velocity change
authorMikko Rasa <tdb@tdb.fi>
Fri, 25 Nov 2022 19:38:42 +0000 (21:38 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 25 Nov 2022 19:38:42 +0000 (21:38 +0200)
examples/bassteroids/source/physics.cpp

index 21c8bd4e9ed7f4b3f57d7aad95ee3bcbd4ff58a8..612a3ece9bde82edb6cdf23fbef3b2b7fc0a248b 100644 (file)
@@ -194,7 +194,7 @@ void Physics::apply_impulses()
                float friction = min(reaction*friction_coeff, v_tan/inv_mass_sum);
                LinAl::Vector<float, 2> impulse = c.normal*reaction+tangent*friction;
                entity1.velocity += impulse*entity1.inverse_mass;
-               entity2.velocity -= impulse*entity2.inverse_momi;
+               entity2.velocity -= impulse*entity2.inverse_mass;
                entity1.angular_velocity += Geometry::Angle<float>::from_radians(entity1.inverse_momi*(r1.x*impulse.y-r1.y*impulse.x));
                entity2.angular_velocity -= Geometry::Angle<float>::from_radians(entity2.inverse_momi*(r2.x*impulse.y-r2.y*impulse.x));
        }