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:
parent
c03598955b
commit
d2af140151
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue