Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-05-01 20:00:59 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-05-01 20:00:59 +0400
commit31adad5b4d8dd7728a1a4d21ede7b34e6ff01a89 (patch)
tree66228fbc8a04bccf11e11a852ece8cce8054c9af /source/gameengine
parent09e102fd01ae45ca7cd47cda8f788f0b5b1ce588 (diff)
Fix BGE bug: dynamic-but-not-rigid objects are added as rigid body during the game.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp9
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp4
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h2
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.