[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16213] trunk/blender/source/gameengine: BGE bug #17411 fixed: the always sensor is called before the the scale of the object is applied.

Benoit Bolsee benoit.bolsee at online.be
Thu Aug 21 23:04:43 CEST 2008


Revision: 16213
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16213
Author:   ben2610
Date:     2008-08-21 23:04:42 +0200 (Thu, 21 Aug 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp	2008-08-21 20:28:33 UTC (rev 16212)
+++ trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp	2008-08-21 21:04:42 UTC (rev 16213)
@@ -801,11 +801,8 @@
 	}
 
 	bm->setMargin(0.06);
-	if (objprop->m_dyna)
-		bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor);
 
 
-
 		if (objprop->m_isCompoundChild)
 		{
 			//find parent, compound shape and add to it
@@ -905,6 +902,8 @@
 	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)

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2008-08-21 20:28:33 UTC (rev 16212)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp	2008-08-21 21:04:42 UTC (rev 16213)
@@ -48,6 +48,10 @@
 	// 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)





More information about the Bf-blender-cvs mailing list