BGE bug #17411 fixed: the always sensor is called before the the scale of the object is applied. The scale is now applied to the shape before the creation of the rigid body.

This commit is contained in:
2008-08-21 21:04:42 +00:00
parent 8551ac5e08
commit 3d3527eb6d
2 changed files with 6 additions and 3 deletions

View File

@@ -801,9 +801,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
}
bm->setMargin(0.06);
if (objprop->m_dyna)
bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
if (objprop->m_isCompoundChild)
@@ -905,6 +902,8 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
ci.m_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter);
ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter);
ci.m_bRigid = objprop->m_dyna && objprop->m_angular_rigidbody;
MT_Vector3 scaling = gameobj->NodeGetWorldScaling();
ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]);
KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna);
// shapeInfo is reference counted, decrement now as we don't use it anymore
if (shapeInfo)

View File

@@ -48,6 +48,10 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
// copy pointers locally to allow smart release
m_MotionState = ci.m_MotionState;
m_collisionShape = ci.m_collisionShape;
// apply scaling before creating rigid body
m_collisionShape->setLocalScaling(m_cci.m_scaling);
if (m_cci.m_mass)
m_collisionShape->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor);
// shape info is shared, increment ref count
m_shapeInfo = ci.m_shapeInfo;
if (m_shapeInfo)