X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=examples%2Fbassteroids%2Fsource%2Fphysics.cpp;h=21c8bd4e9ed7f4b3f57d7aad95ee3bcbd4ff58a8;hb=15afb5af144074d127cfaab7e2df769a561c1448;hp=2453fd90ec82be2ed213eaec91da41c642b1b21f;hpb=9ce882cbb6bb7628d7c9883c43491a75c10625d7;p=libs%2Fgame.git diff --git a/examples/bassteroids/source/physics.cpp b/examples/bassteroids/source/physics.cpp index 2453fd9..21c8bd4 100644 --- a/examples/bassteroids/source/physics.cpp +++ b/examples/bassteroids/source/physics.cpp @@ -191,7 +191,7 @@ void Physics::apply_impulses() float friction_coeff = 0.1f; float inv_mass_sum = entity1.inverse_mass+entity2.inverse_mass; float reaction = (1+restitution)*inner_product(v_rel, c.normal)/inv_mass_sum; - float friction = reaction*friction_coeff; + float friction = min(reaction*friction_coeff, v_tan/inv_mass_sum); LinAl::Vector impulse = c.normal*reaction+tangent*friction; entity1.velocity += impulse*entity1.inverse_mass; entity2.velocity -= impulse*entity2.inverse_momi;