BGE: Fix SetMass function affecting own object gravity.

Each time we setted the mass the own object gravity was divided by its
old mass (i.e you could convert you car in a flying DeLorean with a
simple mass car modification).

A note will be included in release notes due to retro compability
issues.
This commit is contained in:
Jorge Bernal 2015-10-30 06:49:43 +01:00
parent c03598955b
commit d2af140151
1 changed files with 0 additions and 4 deletions

View File

@ -1194,16 +1194,12 @@ void CcdPhysicsController::SetMass(MT_Scalar newmass)
btRigidBody *body = GetRigidBody();
if (body && !m_suspended && newmass>MT_EPSILON && GetMass()>MT_EPSILON)
{
btVector3 grav = body->getGravity();
btVector3 accel = grav / GetMass();
btBroadphaseProxy* handle = body->getBroadphaseHandle();
GetPhysicsEnvironment()->UpdateCcdPhysicsController(this,
newmass,
body->getCollisionFlags(),
handle->m_collisionFilterGroup,
handle->m_collisionFilterMask);
body->setGravity(accel);
}
}