[Bf-blender-cvs] [d2af140] master: BGE: Fix SetMass function affecting own object gravity.
Jorge Bernal
noreply at git.blender.org
Fri Oct 30 06:52:31 CET 2015
Commit: d2af1401510200bcc5d1841d5ef186e7cb545133
Author: Jorge Bernal
Date: Fri Oct 30 06:49:43 2015 +0100
Branches: master
https://developer.blender.org/rBd2af1401510200bcc5d1841d5ef186e7cb545133
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.
===================================================================
M source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index dba65c0..7917f47 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -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);
}
}
More information about the Bf-blender-cvs
mailing list