forked from bartvdbraak/blender
Fix BGE bug: dynamic-but-not-rigid objects are added as rigid body during the game.
This commit is contained in:
parent
09e102fd01
commit
31adad5b4d
@ -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_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_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter);
|
||||||
ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ 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);
|
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)
|
//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);
|
kxscene->AddShape(bm);
|
||||||
@ -1147,6 +1147,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
|
|||||||
//{
|
//{
|
||||||
// rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
|
// rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (objprop->m_dyna && !objprop->m_angular_rigidbody)
|
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);
|
//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;
|
bool isActor = objprop->m_isactor;
|
||||||
|
@ -137,6 +137,10 @@ void CcdPhysicsController::CreateRigidbody()
|
|||||||
m_body->setGravity( m_cci.m_gravity);
|
m_body->setGravity( m_cci.m_gravity);
|
||||||
m_body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping);
|
m_body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping);
|
||||||
|
|
||||||
|
if (!m_cci.m_bRigid)
|
||||||
|
{
|
||||||
|
m_body->setAngularFactor(0.f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CcdPhysicsController::~CcdPhysicsController()
|
CcdPhysicsController::~CcdPhysicsController()
|
||||||
|
@ -60,6 +60,7 @@ struct CcdConstructionInfo
|
|||||||
m_linearDamping(0.1f),
|
m_linearDamping(0.1f),
|
||||||
m_angularDamping(0.1f),
|
m_angularDamping(0.1f),
|
||||||
m_collisionFlags(0),
|
m_collisionFlags(0),
|
||||||
|
m_bRigid(false),
|
||||||
m_collisionFilterGroup(DefaultFilter),
|
m_collisionFilterGroup(DefaultFilter),
|
||||||
m_collisionFilterMask(AllFilter),
|
m_collisionFilterMask(AllFilter),
|
||||||
m_collisionShape(0),
|
m_collisionShape(0),
|
||||||
@ -78,6 +79,7 @@ struct CcdConstructionInfo
|
|||||||
btScalar m_linearDamping;
|
btScalar m_linearDamping;
|
||||||
btScalar m_angularDamping;
|
btScalar m_angularDamping;
|
||||||
int m_collisionFlags;
|
int m_collisionFlags;
|
||||||
|
bool m_bRigid;
|
||||||
|
|
||||||
///optional use of collision group/mask:
|
///optional use of collision group/mask:
|
||||||
///only collision with object goups that match the collision mask.
|
///only collision with object goups that match the collision mask.
|
||||||
|
Loading…
Reference in New Issue
Block a user