mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
removing tabs from formatting
This commit is contained in:
parent
e49c76656f
commit
6840daa0b5
1 changed files with 21 additions and 21 deletions
|
@ -159,14 +159,14 @@ void PhysicsEngine::relayIncomingChangesToSimulation() {
|
||||||
|
|
||||||
void PhysicsEngine::removeContacts(ObjectMotionState* motionState) {
|
void PhysicsEngine::removeContacts(ObjectMotionState* motionState) {
|
||||||
// trigger events for new/existing/old contacts
|
// trigger events for new/existing/old contacts
|
||||||
ContactMap::iterator contactItr = _contactMap.begin();
|
ContactMap::iterator contactItr = _contactMap.begin();
|
||||||
while (contactItr != _contactMap.end()) {
|
while (contactItr != _contactMap.end()) {
|
||||||
if (contactItr->first._a == motionState || contactItr->first._b == motionState) {
|
if (contactItr->first._a == motionState || contactItr->first._b == motionState) {
|
||||||
ContactMap::iterator iterToDelete = contactItr;
|
ContactMap::iterator iterToDelete = contactItr;
|
||||||
++contactItr;
|
++contactItr;
|
||||||
_contactMap.erase(iterToDelete);
|
_contactMap.erase(iterToDelete);
|
||||||
} else {
|
} else {
|
||||||
++contactItr;
|
++contactItr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,26 +251,26 @@ void PhysicsEngine::stepSimulation() {
|
||||||
void PhysicsEngine::computeCollisionEvents() {
|
void PhysicsEngine::computeCollisionEvents() {
|
||||||
// update all contacts
|
// update all contacts
|
||||||
int numManifolds = _collisionDispatcher->getNumManifolds();
|
int numManifolds = _collisionDispatcher->getNumManifolds();
|
||||||
for (int i = 0; i < numManifolds; ++i) {
|
for (int i = 0; i < numManifolds; ++i) {
|
||||||
btPersistentManifold* contactManifold = _collisionDispatcher->getManifoldByIndexInternal(i);
|
btPersistentManifold* contactManifold = _collisionDispatcher->getManifoldByIndexInternal(i);
|
||||||
if (contactManifold->getNumContacts() > 0) {
|
if (contactManifold->getNumContacts() > 0) {
|
||||||
const btCollisionObject* objectA = static_cast<const btCollisionObject*>(contactManifold->getBody0());
|
const btCollisionObject* objectA = static_cast<const btCollisionObject*>(contactManifold->getBody0());
|
||||||
const btCollisionObject* objectB = static_cast<const btCollisionObject*>(contactManifold->getBody1());
|
const btCollisionObject* objectB = static_cast<const btCollisionObject*>(contactManifold->getBody1());
|
||||||
|
|
||||||
void* a = objectA->getUserPointer();
|
void* a = objectA->getUserPointer();
|
||||||
void* b = objectB->getUserPointer();
|
void* b = objectB->getUserPointer();
|
||||||
if (a || b) {
|
if (a || b) {
|
||||||
// the manifold has up to 4 distinct points, but only extract info from the first
|
// the manifold has up to 4 distinct points, but only extract info from the first
|
||||||
_contactMap[ContactKey(a, b)].update(_numSubsteps, contactManifold->getContactPoint(0), _originOffset);
|
_contactMap[ContactKey(a, b)].update(_numSubsteps, contactManifold->getContactPoint(0), _originOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// scan known contacts and trigger events
|
// scan known contacts and trigger events
|
||||||
ContactMap::iterator contactItr = _contactMap.begin();
|
ContactMap::iterator contactItr = _contactMap.begin();
|
||||||
while (contactItr != _contactMap.end()) {
|
while (contactItr != _contactMap.end()) {
|
||||||
ObjectMotionState* A = static_cast<ObjectMotionState*>(contactItr->first._a);
|
ObjectMotionState* A = static_cast<ObjectMotionState*>(contactItr->first._a);
|
||||||
ObjectMotionState* B = static_cast<ObjectMotionState*>(contactItr->first._b);
|
ObjectMotionState* B = static_cast<ObjectMotionState*>(contactItr->first._b);
|
||||||
|
|
||||||
// TODO: make triggering these events clean and efficient. The code at this context shouldn't
|
// TODO: make triggering these events clean and efficient. The code at this context shouldn't
|
||||||
// have to figure out what kind of object (entity, avatar, etc) these are in order to properly
|
// have to figure out what kind of object (entity, avatar, etc) these are in order to properly
|
||||||
|
@ -289,13 +289,13 @@ void PhysicsEngine::computeCollisionEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: enable scripts to filter based on contact event type
|
// TODO: enable scripts to filter based on contact event type
|
||||||
ContactEventType type = contactItr->second.computeType(_numSubsteps);
|
ContactEventType type = contactItr->second.computeType(_numSubsteps);
|
||||||
if (type == CONTACT_EVENT_TYPE_END) {
|
if (type == CONTACT_EVENT_TYPE_END) {
|
||||||
ContactMap::iterator iterToDelete = contactItr;
|
ContactMap::iterator iterToDelete = contactItr;
|
||||||
++contactItr;
|
++contactItr;
|
||||||
_contactMap.erase(iterToDelete);
|
_contactMap.erase(iterToDelete);
|
||||||
} else {
|
} else {
|
||||||
++contactItr;
|
++contactItr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue