idmillington / cyclone-physics

The Physics engine that accompanies the book "Game Physics Engine Design"
MIT License
946 stars 265 forks source link

Finite Mass #23

Open ghost opened 11 years ago

ghost commented 11 years ago

In the book (p 47) it says the inverse mass is used for representing infinite mass

.. objects of infinite mass have a zero inverse mass

but the code in particle.cpp reads

bool Particle::hasFiniteMass() const
{
    return inverseMass >= 0.0f;
}

causing the bug

setInverseMass(0); hasFiniteMass() == true

giordi91 commented 8 years ago

agreed, probably best would be to check if inverse mass is equal to zero (of course using a bias to compensate for numerical precision). I will try to fix this and make a pull request.