diff options
Diffstat (limited to 'source/gameengine')
3 files changed, 12 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 4a61c37be06..e0cd5a3bc9e 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -1123,7 +1123,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour 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; KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna); //remember that we created a shape so that we can delete it when the scene is removed (bullet will not delete it) kxscene->AddShape(bm); @@ -1147,6 +1147,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, //{ // rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE); //} + if (objprop->m_dyna && !objprop->m_angular_rigidbody) { /* @@ -1161,8 +1162,10 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, */ //env->createConstraint(physicscontroller,0,PHY_ANGULAR_CONSTRAINT,0,0,0,0,0,1); - physicscontroller->GetRigidBody()->setAngularFactor(0.f); - + + //Now done directly in ci.m_bRigid so that it propagates to replica + //physicscontroller->GetRigidBody()->setAngularFactor(0.f); + ; } bool isActor = objprop->m_isactor; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index d99b75482b9..e444c4c73be 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -137,6 +137,10 @@ void CcdPhysicsController::CreateRigidbody() m_body->setGravity( m_cci.m_gravity); m_body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping); + if (!m_cci.m_bRigid) + { + m_body->setAngularFactor(0.f); + } } CcdPhysicsController::~CcdPhysicsController() diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 54b4bcc40ee..37fa465351f 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -60,6 +60,7 @@ struct CcdConstructionInfo m_linearDamping(0.1f), m_angularDamping(0.1f), m_collisionFlags(0), + m_bRigid(false), m_collisionFilterGroup(DefaultFilter), m_collisionFilterMask(AllFilter), m_collisionShape(0), @@ -78,6 +79,7 @@ struct CcdConstructionInfo btScalar m_linearDamping; btScalar m_angularDamping; int m_collisionFlags; + bool m_bRigid; ///optional use of collision group/mask: ///only collision with object goups that match the collision mask. |