BGE real-time soft bodies, step 2 / 3: create a btSoftBody. Next step is hooking...
[blender-staging.git] / source / gameengine / Ketsji / KX_ConvertPhysicsObjects.cpp
index 6f5f9e22506978d61eac3ca085f6882a634ca1e2..46b53d07efc6f68f0989ae283b47a05425c6c6cd 100644 (file)
@@ -917,6 +917,7 @@ 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;
+       ci.m_bSoft = objprop->m_softbody;
        MT_Vector3 scaling = gameobj->NodeGetWorldScaling();
        ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]);
        KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna);
@@ -933,10 +934,12 @@ void      KX_ConvertBulletObject( class   KX_GameObject* gameobj,
 
        gameobj->SetPhysicsController(physicscontroller,isbulletdyna);
        physicscontroller->setNewClientInfo(gameobj->getClientInfo());          
-       btRigidBody* rbody = physicscontroller->GetRigidBody();
+       {
+               btRigidBody* rbody = physicscontroller->GetRigidBody();
 
-       if (objprop->m_disableSleeping)
-               rbody->setActivationState(DISABLE_DEACTIVATION);
+               if (rbody && objprop->m_disableSleeping)
+                       rbody->setActivationState(DISABLE_DEACTIVATION);
+       }
        
        //Now done directly in ci.m_collisionFlags so that it propagates to replica
        //if (objprop->m_ghost)