fixed copy/paste bug in physicscontroller applyforce, and crashing radar sensor
authorErwin Coumans <blender@erwincoumans.com>
Fri, 6 Jan 2006 09:57:27 +0000 (09:57 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Fri, 6 Jan 2006 09:57:27 +0000 (09:57 +0000)
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

index ea656877e9277aea8cfca69cf0cbfaf7624d64bf..eae9784935c80b0d9149985fef6dc9f69a127eef 100644 (file)
@@ -93,7 +93,11 @@ CValue* KX_RadarSensor::GetReplica()
        
        replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::RADAR);
        
-       replica->m_physCtrl = replica->m_physCtrl->GetReplica();
+       if (replica->m_physCtrl)
+       {
+               replica->m_physCtrl = replica->m_physCtrl->GetReplica();
+       }
+
        //todo: make sure replication works fine!
        //>m_sumoObj = new SM_Object(DT_NewCone(m_coneradius, m_coneheight),NULL,NULL,NULL);
        //replica->m_sumoObj->setMargin(m_Margin);
@@ -151,9 +155,12 @@ void KX_RadarSensor::SynchronizeTransform()
        m_cone_target = trans(MT_Point3(0, -m_coneheight/2.0 ,0));
 
 
-       m_physCtrl->setPosition(trans.getOrigin().x(),trans.getOrigin().y(),trans.getOrigin().z());
-       m_physCtrl->setOrientation(trans.getRotation().x(),trans.getRotation().y(),trans.getRotation().z(),trans.getRotation().w());
-       m_physCtrl->calcXform();
+       if (m_physCtrl)
+       {
+               m_physCtrl->setPosition(trans.getOrigin().x(),trans.getOrigin().y(),trans.getOrigin().z());
+               m_physCtrl->setOrientation(trans.getRotation().x(),trans.getRotation().y(),trans.getRotation().z(),trans.getRotation().w());
+               m_physCtrl->calcXform();
+       }
 
 }
 
index 7051b8f7e1318bd20ca11c8632f7db3fa8c7bcce..0db5ce4e6689562aa6eb89eec5a6ded1ea4ccb18 100644 (file)
@@ -272,7 +272,7 @@ void                CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque
 
 void           CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local)
 {
-       SimdVector3 force(forceX,forceX,forceX);
+       SimdVector3 force(forceX,forceY,forceZ);
        SimdTransform xform = m_body->getCenterOfMassTransform();
        if (local)
        {