Merge remote-tracking branch 'origin/Physics' into GameLogic
This commit is contained in:
commit
8e0f6eefda
|
@ -90,7 +90,7 @@ using namespace DanBias;
|
|||
{
|
||||
for (unsigned int i = 0; i < this->gClients.Size(); i++)
|
||||
{
|
||||
if(this->gClients[i] )
|
||||
if(this->gClients[i] && !this->gClients[i]->IsInvalid())
|
||||
{
|
||||
this->gClients[i]->UpdateClient();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ using namespace DanBias;
|
|||
bool returnValue = false;
|
||||
for (unsigned int i = 0; i < this->gClients.Size(); i++)
|
||||
{
|
||||
if(this->gClients[i])
|
||||
if(this->gClients[i] && !this->gClients[i]->IsInvalid())
|
||||
{
|
||||
this->gClients[i]->GetClient()->Send(message);
|
||||
returnValue = true;
|
||||
|
@ -115,7 +115,7 @@ using namespace DanBias;
|
|||
{
|
||||
for (unsigned int i = 0; i < this->gClients.Size(); i++)
|
||||
{
|
||||
if(this->gClients[i] && this->gClients[i]->GetClient()->GetID() == ID)
|
||||
if(this->gClients[i] && !this->gClients[i]->IsInvalid() && this->gClients[i]->GetClient()->GetID() == ID)
|
||||
{
|
||||
this->gClients[i]->GetClient()->Send(protocol);
|
||||
return true;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ SimpleRigidBody::SimpleRigidBody()
|
|||
this->state.restitutionCoeff = 0.0f;
|
||||
this->state.reach = Float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
this->collisionFlags = 0;
|
||||
|
||||
this->afterCollision = NULL;
|
||||
this->onMovement = NULL;
|
||||
|
||||
|
@ -85,7 +87,7 @@ void SimpleRigidBody::SetMotionState(btDefaultMotionState* motionState)
|
|||
void SimpleRigidBody::SetRigidBody(btRigidBody* rigidBody)
|
||||
{
|
||||
this->rigidBody = rigidBody;
|
||||
|
||||
this->collisionFlags = rigidBody->getCollisionFlags();
|
||||
}
|
||||
|
||||
void SimpleRigidBody::SetSubscription(EventAction_AfterCollisionResponse function)
|
||||
|
@ -421,7 +423,7 @@ void SimpleRigidBody::MoveToLimbo()
|
|||
|
||||
void SimpleRigidBody::ReleaseFromLimbo()
|
||||
{
|
||||
this->rigidBody->setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT);
|
||||
this->rigidBody->setCollisionFlags(this->collisionFlags);
|
||||
}
|
||||
|
||||
void SimpleRigidBody::SetPreviousVelocity(::Oyster::Math::Float3 velocity)
|
||||
|
|
|
@ -93,6 +93,8 @@ namespace Oyster
|
|||
btVector3 raySource[2];
|
||||
btVector3 rayTarget[2];
|
||||
btScalar rayLambda[2];
|
||||
|
||||
int collisionFlags;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue