[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16007] trunk/blender/source/gameengine: BGE bug #17408 fixed: Radar sensor is oriented the wrong way when the set along negative axis.

Benoit Bolsee benoit.bolsee at online.be
Thu Aug 7 19:29:07 CEST 2008


Revision: 16007
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16007
Author:   ben2610
Date:     2008-08-07 19:29:06 +0200 (Thu, 07 Aug 2008)

Log Message:
-----------
BGE bug #17408 fixed: Radar sensor is oriented the wrong way when the set along negative axis. Improve reliability of Radar detection by clearing the manifold cache instead of updating it.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_RadarSensor.cpp
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_RadarSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_RadarSensor.cpp	2008-08-07 17:27:29 UTC (rev 16006)
+++ trunk/blender/source/gameengine/Ketsji/KX_RadarSensor.cpp	2008-08-07 17:29:06 UTC (rev 16007)
@@ -147,23 +147,23 @@
 		};
 	case 3: // -X Axis
 		{
-			MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90));
+			MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90));
 			trans.rotate(rotquatje);
-			trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
+			trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
 			break;
 		};
 	case 4: // -Y Axis
 		{
-			MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
-			trans.rotate(rotquatje);
-			trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
+			//MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180));
+			//trans.rotate(rotquatje);
+			trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
 			break;
 		};
 	case 5: // -Z Axis
 		{
-			MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90));
+			MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90));
 			trans.rotate(rotquatje);
-			trans.translate(MT_Vector3 (0, m_coneheight/2.0 ,0));
+			trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0));
 			break;
 		};
 	default:

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2008-08-07 17:27:29 UTC (rev 16006)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2008-08-07 17:29:06 UTC (rev 16007)
@@ -966,15 +966,6 @@
 			{
 				btRigidBody* rb0 = static_cast<btRigidBody*>(manifold->getBody0());
 				btRigidBody* rb1 = static_cast<btRigidBody*>(manifold->getBody1());
-				// Bullet does not refresh the manifold contact point for object without contact response
-				// may need to remove this when a newer Bullet version is integrated
-				if (!dispatcher->needsResponse(rb0, rb1))
-				{
-					manifold->refreshContactPoints(rb0->getCenterOfMassTransform(),rb1->getCenterOfMassTransform());
-					numContacts = manifold->getNumContacts();
-					if (!numContacts)
-						continue;
-				}
 				if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))
 				{
 					for (int j=0;j<numContacts;j++)
@@ -1003,6 +994,15 @@
 					m_triggerCallbacks[PHY_OBJECT_RESPONSE](m_triggerCallbacksUserPtrs[PHY_OBJECT_RESPONSE],
 						ctrl0,ctrl1,0);
 				}
+				// Bullet does not refresh the manifold contact point for object without contact response
+				// may need to remove this when a newer Bullet version is integrated
+				if (!dispatcher->needsResponse(rb0, rb1))
+				{
+					// Refresh algorithm fails sometimes when there is penetration 
+					// (usuall the case with ghost and sensor objects)
+					// Let's just clear the manifold, in any case, it is recomputed on each frame.
+					manifold->clearManifold(); //refreshContactPoints(rb0->getCenterOfMassTransform(),rb1->getCenterOfMassTransform());
+				}
 			}
 		}
 





More information about the Bf-blender-cvs mailing list