Fixed multiple collisions

This commit is contained in:
Robin Engman 2014-02-21 14:09:38 +01:00
parent d7e0b55a82
commit 954dc67f7a
2 changed files with 30 additions and 5 deletions

View File

@ -36,8 +36,8 @@ GameSession::GameSession()
this->isCreated = false;
this->isRunning = false;
this->gameSession = this;
this->logicFrameTime = DELTA_TIME_20;
this->networkFrameTime = DELTA_TIME_20;
this->logicFrameTime = DELTA_TIME_120;
this->networkFrameTime = DELTA_TIME_120;
this->networkTimer.reset();
this->logicTimer.reset();

View File

@ -291,7 +291,7 @@ void API_Impl::UpdateWorld()
simpleBody->SetPreviousVelocity(simpleBody->GetLinearVelocity());
}
this->dynamicsWorld->stepSimulation(this->timeStep, 1, this->timeStep);
this->dynamicsWorld->stepSimulation(this->timeStep, 10, this->timeStep);
ICustomBody::State state;
@ -314,9 +314,34 @@ void API_Impl::UpdateWorld()
ICustomBody* bodyA = (ICustomBody*)obA->getUserPointer();
ICustomBody* bodyB = (ICustomBody*)obB->getUserPointer();
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)
{
btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f)
{
if(bodyA->GetState().mass == 40 && bodyB->GetState().centerPos == Float3::null)
{
const char* breakPoint = "STOP";
}
if(bodyB->GetState().mass == 40 && bodyA->GetState().centerPos == Float3::null)
{
const char* breakPoint = "STOP";
}
const btVector3& ptA = pt.getPositionWorldOnA();
const btVector3& ptB = pt.getPositionWorldOnB();
const btVector3& normalOnB = pt.m_normalWorldOnB;
bodyA->CallSubscription_AfterCollisionResponse(bodyA, bodyB, 0.0f);
bodyB->CallSubscription_AfterCollisionResponse(bodyB, bodyA, 0.0f);
}
}
}
}