some fixes, related to object activation in game blender
This commit is contained in:
@@ -41,9 +41,9 @@ void btCollisionObject::forceActivationState(int newState)
|
||||
m_activationState1 = newState;
|
||||
}
|
||||
|
||||
void btCollisionObject::activate()
|
||||
void btCollisionObject::activate(bool forceActivation)
|
||||
{
|
||||
if (!(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
|
||||
if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
|
||||
{
|
||||
setActivationState(ACTIVE_TAG);
|
||||
m_deactivationTime = 0.f;
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
|
||||
void forceActivationState(int newState);
|
||||
|
||||
void activate();
|
||||
void activate(bool forceActivation = false);
|
||||
|
||||
inline bool isActive() const
|
||||
{
|
||||
|
||||
@@ -176,7 +176,8 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (allSleeping)
|
||||
{
|
||||
int idx;
|
||||
@@ -239,14 +240,15 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
if (((colObj0) && colObj0->getActivationState() != ISLAND_SLEEPING) ||
|
||||
((colObj1) && colObj1->getActivationState() != ISLAND_SLEEPING))
|
||||
{
|
||||
|
||||
//kinematic objects don't merge islands, but wake up all connected objects
|
||||
if (colObj0->isKinematicObject() && colObj0->getActivationState() != ISLAND_SLEEPING)
|
||||
if (colObj0->isStaticOrKinematicObject() && colObj0->getActivationState() != ISLAND_SLEEPING)
|
||||
{
|
||||
colObj1->setActivationState(ACTIVE_TAG);
|
||||
colObj1->activate();
|
||||
}
|
||||
if (colObj1->isKinematicObject() && colObj1->getActivationState() != ISLAND_SLEEPING)
|
||||
if (colObj1->isStaticOrKinematicObject() && colObj1->getActivationState() != ISLAND_SLEEPING)
|
||||
{
|
||||
colObj0->setActivationState(ACTIVE_TAG);
|
||||
colObj0->activate();
|
||||
}
|
||||
|
||||
//filtering for response
|
||||
|
||||
@@ -368,8 +368,14 @@ void btDiscreteDynamicsWorld::updateActivationState(float timeStep)
|
||||
|
||||
if (body->wantsSleeping())
|
||||
{
|
||||
if (body->getActivationState() == ACTIVE_TAG)
|
||||
body->setActivationState( WANTS_DEACTIVATION );
|
||||
if (body->isStaticOrKinematicObject())
|
||||
{
|
||||
body->setActivationState(ISLAND_SLEEPING);
|
||||
} else
|
||||
{
|
||||
if (body->getActivationState() == ACTIVE_TAG)
|
||||
body->setActivationState( WANTS_DEACTIVATION );
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (body->getActivationState() != DISABLE_DEACTIVATION)
|
||||
|
||||
Reference in New Issue
Block a user