[STYLE] correct some coding style
This commit is contained in:
parent
33f24d6b17
commit
b85098fcaa
@ -40,20 +40,16 @@ void CollisionDetection::computeCollisionDetection() {
|
|||||||
computeNarrowPhase();
|
computeNarrowPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::testCollisionBetweenShapes(CollisionCallback* callback,
|
void CollisionDetection::testCollisionBetweenShapes(CollisionCallback* _callback, const etk::Set<uint32_t>& _shapes1, const etk::Set<uint32_t>& _shapes2) {
|
||||||
const etk::Set<uint32_t>& shapes1,
|
|
||||||
const etk::Set<uint32_t>& shapes2) {
|
|
||||||
// Compute the broad-phase collision detection
|
// Compute the broad-phase collision detection
|
||||||
computeBroadPhase();
|
computeBroadPhase();
|
||||||
// Delete all the contact points in the currently overlapping pairs
|
// Delete all the contact points in the currently overlapping pairs
|
||||||
clearContactPoints();
|
clearContactPoints();
|
||||||
// Compute the narrow-phase collision detection among given sets of shapes
|
// Compute the narrow-phase collision detection among given sets of shapes
|
||||||
computeNarrowPhaseBetweenShapes(callback, shapes1, shapes2);
|
computeNarrowPhaseBetweenShapes(_callback, _shapes1, _shapes2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* callback,
|
void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* _callback, const etk::Set<uint32_t>& _shapes1, const etk::Set<uint32_t>& _shapes2) {
|
||||||
const etk::Set<uint32_t>& shapes1,
|
|
||||||
const etk::Set<uint32_t>& shapes2) {
|
|
||||||
// For each possible collision pair of bodies
|
// For each possible collision pair of bodies
|
||||||
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
||||||
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ++it) {
|
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ++it) {
|
||||||
@ -63,24 +59,24 @@ void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* callbac
|
|||||||
assert(shape1->m_broadPhaseID != shape2->m_broadPhaseID);
|
assert(shape1->m_broadPhaseID != shape2->m_broadPhaseID);
|
||||||
// If both shapes1 and shapes2 sets are non-empty, we check that
|
// If both shapes1 and shapes2 sets are non-empty, we check that
|
||||||
// shape1 is among on set and shape2 is among the other one
|
// shape1 is among on set and shape2 is among the other one
|
||||||
if ( !shapes1.empty()
|
if ( !_shapes1.empty()
|
||||||
&& !shapes2.empty()
|
&& !_shapes2.empty()
|
||||||
&& ( shapes1.count(shape1->m_broadPhaseID) == 0
|
&& ( _shapes1.count(shape1->m_broadPhaseID) == 0
|
||||||
|| shapes2.count(shape2->m_broadPhaseID) == 0 )
|
|| _shapes2.count(shape2->m_broadPhaseID) == 0 )
|
||||||
&& ( shapes1.count(shape2->m_broadPhaseID) == 0
|
&& ( _shapes1.count(shape2->m_broadPhaseID) == 0
|
||||||
|| shapes2.count(shape1->m_broadPhaseID) == 0 ) ) {
|
|| _shapes2.count(shape1->m_broadPhaseID) == 0 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !shapes1.empty()
|
if ( !_shapes1.empty()
|
||||||
&& shapes2.empty()
|
&& _shapes2.empty()
|
||||||
&& shapes1.count(shape1->m_broadPhaseID) == 0
|
&& _shapes1.count(shape1->m_broadPhaseID) == 0
|
||||||
&& shapes1.count(shape2->m_broadPhaseID) == 0) {
|
&& _shapes1.count(shape2->m_broadPhaseID) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !shapes2.empty()
|
if ( !_shapes2.empty()
|
||||||
&& shapes1.empty()
|
&& _shapes1.empty()
|
||||||
&& shapes2.count(shape1->m_broadPhaseID) == 0
|
&& _shapes2.count(shape1->m_broadPhaseID) == 0
|
||||||
&& shapes2.count(shape2->m_broadPhaseID) == 0) {
|
&& _shapes2.count(shape2->m_broadPhaseID) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// For each contact manifold set of the overlapping pair
|
// For each contact manifold set of the overlapping pair
|
||||||
@ -99,8 +95,8 @@ void CollisionDetection::reportCollisionBetweenShapes(CollisionCallback* callbac
|
|||||||
contactPoint->getLocalPointOnBody1(),
|
contactPoint->getLocalPointOnBody1(),
|
||||||
contactPoint->getLocalPointOnBody2());
|
contactPoint->getLocalPointOnBody2());
|
||||||
// Notify the collision callback about this new contact
|
// Notify the collision callback about this new contact
|
||||||
if (callback != nullptr) {
|
if (_callback != nullptr) {
|
||||||
callback->notifyContact(contactInfo);
|
_callback->notifyContact(contactInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,9 +180,7 @@ void CollisionDetection::computeNarrowPhase() {
|
|||||||
addAllContactManifoldsToBodies();
|
addAllContactManifoldsToBodies();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* callback,
|
void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* _callback, const etk::Set<uint32_t>& _shapes1, const etk::Set<uint32_t>& _shapes2) {
|
||||||
const etk::Set<uint32_t>& shapes1,
|
|
||||||
const etk::Set<uint32_t>& shapes2) {
|
|
||||||
m_contactOverlappingPairs.clear();
|
m_contactOverlappingPairs.clear();
|
||||||
// For each possible collision pair of bodies
|
// For each possible collision pair of bodies
|
||||||
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
||||||
@ -197,35 +191,35 @@ void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* call
|
|||||||
assert(shape1->m_broadPhaseID != shape2->m_broadPhaseID);
|
assert(shape1->m_broadPhaseID != shape2->m_broadPhaseID);
|
||||||
// If both shapes1 and shapes2 sets are non-empty, we check that
|
// If both shapes1 and shapes2 sets are non-empty, we check that
|
||||||
// shape1 is among on set and shape2 is among the other one
|
// shape1 is among on set and shape2 is among the other one
|
||||||
if ( !shapes1.empty()
|
if ( !_shapes1.empty()
|
||||||
&& !shapes2.empty()
|
&& !_shapes2.empty()
|
||||||
&& ( shapes1.count(shape1->m_broadPhaseID) == 0
|
&& ( _shapes1.count(shape1->m_broadPhaseID) == 0
|
||||||
|| shapes2.count(shape2->m_broadPhaseID) == 0 )
|
|| _shapes2.count(shape2->m_broadPhaseID) == 0 )
|
||||||
&& ( shapes1.count(shape2->m_broadPhaseID) == 0
|
&& ( _shapes1.count(shape2->m_broadPhaseID) == 0
|
||||||
|| shapes2.count(shape1->m_broadPhaseID) == 0 ) ) {
|
|| _shapes2.count(shape1->m_broadPhaseID) == 0 ) ) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !shapes1.empty()
|
if ( !_shapes1.empty()
|
||||||
&& shapes2.empty()
|
&& _shapes2.empty()
|
||||||
&& shapes1.count(shape1->m_broadPhaseID) == 0
|
&& _shapes1.count(shape1->m_broadPhaseID) == 0
|
||||||
&& shapes1.count(shape2->m_broadPhaseID) == 0) {
|
&& _shapes1.count(shape2->m_broadPhaseID) == 0) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !shapes2.empty()
|
if ( !_shapes2.empty()
|
||||||
&& shapes1.empty()
|
&& _shapes1.empty()
|
||||||
&& shapes2.count(shape1->m_broadPhaseID) == 0
|
&& _shapes2.count(shape1->m_broadPhaseID) == 0
|
||||||
&& shapes2.count(shape2->m_broadPhaseID) == 0) {
|
&& _shapes2.count(shape2->m_broadPhaseID) == 0) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Check if the collision filtering allows collision between the two shapes and
|
// Check if the collision filtering allows collision between the two shapes and
|
||||||
// that the two shapes are still overlapping. Otherwise, we destroy the
|
// that the two shapes are still overlapping. Otherwise, we destroy the
|
||||||
// overlapping pair
|
// overlapping pair
|
||||||
if (((shape1->getCollideWithMaskBits() & shape2->getCollisionCategoryBits()) == 0 ||
|
if ( ( (shape1->getCollideWithMaskBits() & shape2->getCollisionCategoryBits()) == 0
|
||||||
(shape1->getCollisionCategoryBits() & shape2->getCollideWithMaskBits()) == 0) ||
|
|| (shape1->getCollisionCategoryBits() & shape2->getCollideWithMaskBits()) == 0 )
|
||||||
!m_broadPhaseAlgorithm.testOverlappingShapes(shape1, shape2)) {
|
|| !m_broadPhaseAlgorithm.testOverlappingShapes(shape1, shape2) ) {
|
||||||
// TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved
|
// TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved
|
||||||
// Destroy the overlapping pair
|
// Destroy the overlapping pair
|
||||||
ETK_DELETE(OverlappingPair, it->second);
|
ETK_DELETE(OverlappingPair, it->second);
|
||||||
@ -262,11 +256,17 @@ void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* call
|
|||||||
// Notify the narrow-phase algorithm about the overlapping pair we are going to test
|
// Notify the narrow-phase algorithm about the overlapping pair we are going to test
|
||||||
narrowPhaseAlgorithm->setCurrentOverlappingPair(pair);
|
narrowPhaseAlgorithm->setCurrentOverlappingPair(pair);
|
||||||
// Create the CollisionShapeInfo objects
|
// Create the CollisionShapeInfo objects
|
||||||
CollisionShapeInfo shape1Info(shape1, shape1->getCollisionShape(), shape1->getLocalToWorldTransform(),
|
CollisionShapeInfo shape1Info(shape1,
|
||||||
pair, shape1->getCachedCollisionData());
|
shape1->getCollisionShape(),
|
||||||
CollisionShapeInfo shape2Info(shape2, shape2->getCollisionShape(), shape2->getLocalToWorldTransform(),
|
shape1->getLocalToWorldTransform(),
|
||||||
pair, shape2->getCachedCollisionData());
|
pair,
|
||||||
TestCollisionBetweenShapesCallback narrowPhaseCallback(callback);
|
shape1->getCachedCollisionData());
|
||||||
|
CollisionShapeInfo shape2Info(shape2,
|
||||||
|
shape2->getCollisionShape(),
|
||||||
|
shape2->getLocalToWorldTransform(),
|
||||||
|
pair,
|
||||||
|
shape2->getCachedCollisionData());
|
||||||
|
TestCollisionBetweenShapesCallback narrowPhaseCallback(_callback);
|
||||||
// Use the narrow-phase collision detection algorithm to check
|
// Use the narrow-phase collision detection algorithm to check
|
||||||
// if there really is a collision
|
// if there really is a collision
|
||||||
narrowPhaseAlgorithm->testCollision(shape1Info, shape2Info, &narrowPhaseCallback);
|
narrowPhaseAlgorithm->testCollision(shape1Info, shape2Info, &narrowPhaseCallback);
|
||||||
@ -275,39 +275,39 @@ void CollisionDetection::computeNarrowPhaseBetweenShapes(CollisionCallback* call
|
|||||||
addAllContactManifoldsToBodies();
|
addAllContactManifoldsToBodies();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::broadPhaseNotifyOverlappingPair(ProxyShape* shape1, ProxyShape* shape2) {
|
void CollisionDetection::broadPhaseNotifyOverlappingPair(ProxyShape* _shape1, ProxyShape* _shape2) {
|
||||||
assert(shape1->m_broadPhaseID != shape2->m_broadPhaseID);
|
assert(_shape1->m_broadPhaseID != _shape2->m_broadPhaseID);
|
||||||
// If the two proxy collision shapes are from the same body, skip it
|
// If the two proxy collision shapes are from the same body, skip it
|
||||||
if (shape1->getBody()->getID() == shape2->getBody()->getID()) {
|
if (_shape1->getBody()->getID() == _shape2->getBody()->getID()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check if the collision filtering allows collision between the two shapes
|
// Check if the collision filtering allows collision between the two shapes
|
||||||
if ( (shape1->getCollideWithMaskBits() & shape2->getCollisionCategoryBits()) == 0
|
if ( (_shape1->getCollideWithMaskBits() & _shape2->getCollisionCategoryBits()) == 0
|
||||||
|| (shape1->getCollisionCategoryBits() & shape2->getCollideWithMaskBits()) == 0) {
|
|| (_shape1->getCollisionCategoryBits() & _shape2->getCollideWithMaskBits()) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Compute the overlapping pair ID
|
// Compute the overlapping pair ID
|
||||||
overlappingpairid pairID = OverlappingPair::computeID(shape1, shape2);
|
overlappingpairid pairID = OverlappingPair::computeID(_shape1, _shape2);
|
||||||
// Check if the overlapping pair already exists
|
// Check if the overlapping pair already exists
|
||||||
if (m_overlappingPairs.find(pairID) != m_overlappingPairs.end()) return;
|
if (m_overlappingPairs.find(pairID) != m_overlappingPairs.end()) return;
|
||||||
// Compute the maximum number of contact manifolds for this pair
|
// Compute the maximum number of contact manifolds for this pair
|
||||||
int32_t nbMaxManifolds = CollisionShape::computeNbMaxContactManifolds(shape1->getCollisionShape()->getType(),
|
int32_t nbMaxManifolds = CollisionShape::computeNbMaxContactManifolds(_shape1->getCollisionShape()->getType(),
|
||||||
shape2->getCollisionShape()->getType());
|
_shape2->getCollisionShape()->getType());
|
||||||
// Create the overlapping pair and add it int32_to the set of overlapping pairs
|
// Create the overlapping pair and add it int32_to the set of overlapping pairs
|
||||||
OverlappingPair* newPair = ETK_NEW(OverlappingPair, shape1, shape2, nbMaxManifolds);
|
OverlappingPair* newPair = ETK_NEW(OverlappingPair, _shape1, _shape2, nbMaxManifolds);
|
||||||
assert(newPair != nullptr);
|
assert(newPair != nullptr);
|
||||||
m_overlappingPairs.set(pairID, newPair);
|
m_overlappingPairs.set(pairID, newPair);
|
||||||
// Wake up the two bodies
|
// Wake up the two bodies
|
||||||
shape1->getBody()->setIsSleeping(false);
|
_shape1->getBody()->setIsSleeping(false);
|
||||||
shape2->getBody()->setIsSleeping(false);
|
_shape2->getBody()->setIsSleeping(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::removeProxyCollisionShape(ProxyShape* proxyShape) {
|
void CollisionDetection::removeProxyCollisionShape(ProxyShape* _proxyShape) {
|
||||||
// Remove all the overlapping pairs involving this proxy shape
|
// Remove all the overlapping pairs involving this proxy shape
|
||||||
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
||||||
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ) {
|
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ) {
|
||||||
if (it->second->getShape1()->m_broadPhaseID == proxyShape->m_broadPhaseID||
|
if (it->second->getShape1()->m_broadPhaseID == _proxyShape->m_broadPhaseID||
|
||||||
it->second->getShape2()->m_broadPhaseID == proxyShape->m_broadPhaseID) {
|
it->second->getShape2()->m_broadPhaseID == _proxyShape->m_broadPhaseID) {
|
||||||
// TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved
|
// TODO : Remove all the contact manifold of the overlapping pair from the contact manifolds list of the two bodies involved
|
||||||
// Destroy the overlapping pair
|
// Destroy the overlapping pair
|
||||||
ETK_DELETE(OverlappingPair, it->second);
|
ETK_DELETE(OverlappingPair, it->second);
|
||||||
@ -318,34 +318,34 @@ void CollisionDetection::removeProxyCollisionShape(ProxyShape* proxyShape) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove the body from the broad-phase
|
// Remove the body from the broad-phase
|
||||||
m_broadPhaseAlgorithm.removeProxyCollisionShape(proxyShape);
|
m_broadPhaseAlgorithm.removeProxyCollisionShape(_proxyShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::notifyContact(OverlappingPair* overlappingPair, const ContactPointInfo& contactInfo) {
|
void CollisionDetection::notifyContact(OverlappingPair* _overlappingPair, const ContactPointInfo& _contactInfo) {
|
||||||
// If it is the first contact since the pairs are overlapping
|
// If it is the first contact since the pairs are overlapping
|
||||||
if (overlappingPair->getNbContactPoints() == 0) {
|
if (_overlappingPair->getNbContactPoints() == 0) {
|
||||||
// Trigger a callback event
|
// Trigger a callback event
|
||||||
if (m_world->m_eventListener != NULL) {
|
if (m_world->m_eventListener != NULL) {
|
||||||
m_world->m_eventListener->beginContact(contactInfo);
|
m_world->m_eventListener->beginContact(_contactInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create a new contact
|
// Create a new contact
|
||||||
createContact(overlappingPair, contactInfo);
|
createContact(_overlappingPair, _contactInfo);
|
||||||
// Trigger a callback event for the new contact
|
// Trigger a callback event for the new contact
|
||||||
if (m_world->m_eventListener != NULL) {
|
if (m_world->m_eventListener != NULL) {
|
||||||
m_world->m_eventListener->newContact(contactInfo);
|
m_world->m_eventListener->newContact(_contactInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::createContact(OverlappingPair* overlappingPair, const ContactPointInfo& contactInfo) {
|
void CollisionDetection::createContact(OverlappingPair* _overlappingPair, const ContactPointInfo& _contactInfo) {
|
||||||
// Create a new contact
|
// Create a new contact
|
||||||
ContactPoint* contact = ETK_NEW(ContactPoint, contactInfo);
|
ContactPoint* contact = ETK_NEW(ContactPoint, _contactInfo);
|
||||||
// Add the contact to the contact manifold set of the corresponding overlapping pair
|
// Add the contact to the contact manifold set of the corresponding overlapping pair
|
||||||
overlappingPair->addContact(contact);
|
_overlappingPair->addContact(contact);
|
||||||
// Add the overlapping pair int32_to the set of pairs in contact during narrow-phase
|
// Add the overlapping pair int32_to the set of pairs in contact during narrow-phase
|
||||||
overlappingpairid pairId = OverlappingPair::computeID(overlappingPair->getShape1(),
|
overlappingpairid pairId = OverlappingPair::computeID(_overlappingPair->getShape1(),
|
||||||
overlappingPair->getShape2());
|
_overlappingPair->getShape2());
|
||||||
m_contactOverlappingPairs.set(pairId, overlappingPair);
|
m_contactOverlappingPairs.set(pairId, _overlappingPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::addAllContactManifoldsToBodies() {
|
void CollisionDetection::addAllContactManifoldsToBodies() {
|
||||||
@ -358,11 +358,11 @@ void CollisionDetection::addAllContactManifoldsToBodies() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::addContactManifoldToBody(OverlappingPair* pair) {
|
void CollisionDetection::addContactManifoldToBody(OverlappingPair* _pair) {
|
||||||
assert(pair != nullptr);
|
assert(_pair != nullptr);
|
||||||
CollisionBody* body1 = pair->getShape1()->getBody();
|
CollisionBody* body1 = _pair->getShape1()->getBody();
|
||||||
CollisionBody* body2 = pair->getShape2()->getBody();
|
CollisionBody* body2 = _pair->getShape2()->getBody();
|
||||||
const ContactManifoldSet& manifoldSet = pair->getContactManifoldSet();
|
const ContactManifoldSet& manifoldSet = _pair->getContactManifoldSet();
|
||||||
// For each contact manifold in the set of manifolds in the pair
|
// For each contact manifold in the set of manifolds in the pair
|
||||||
for (int32_t i=0; i<manifoldSet.getNbContactManifolds(); i++) {
|
for (int32_t i=0; i<manifoldSet.getNbContactManifolds(); i++) {
|
||||||
ContactManifold* contactManifold = manifoldSet.getContactManifold(i);
|
ContactManifold* contactManifold = manifoldSet.getContactManifold(i);
|
||||||
@ -377,7 +377,6 @@ void CollisionDetection::addContactManifoldToBody(OverlappingPair* pair) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::clearContactPoints() {
|
void CollisionDetection::clearContactPoints() {
|
||||||
|
|
||||||
// For each overlapping pair
|
// For each overlapping pair
|
||||||
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
etk::Map<overlappingpairid, OverlappingPair*>::Iterator it;
|
||||||
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ++it) {
|
for (it = m_overlappingPairs.begin(); it != m_overlappingPairs.end(); ++it) {
|
||||||
@ -398,8 +397,7 @@ EventListener* CollisionDetection::getWorldEventListener() {
|
|||||||
return m_world->m_eventListener;
|
return m_world->m_eventListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCollisionBetweenShapesCallback::notifyContact(OverlappingPair* _overlappingPair,
|
void TestCollisionBetweenShapesCallback::notifyContact(OverlappingPair* _overlappingPair, const ContactPointInfo& _contactInfo) {
|
||||||
const ContactPointInfo& _contactInfo) {
|
|
||||||
m_collisionCallback->notifyContact(_contactInfo);
|
m_collisionCallback->notifyContact(_contactInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,41 +418,37 @@ void CollisionDetection::addProxyCollisionShape(ProxyShape* _proxyShape, const A
|
|||||||
m_isCollisionShapesAdded = true;
|
m_isCollisionShapesAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::addNoCollisionPair(CollisionBody* body1, CollisionBody* body2) {
|
void CollisionDetection::addNoCollisionPair(CollisionBody* _body1, CollisionBody* _body2) {
|
||||||
m_noCollisionPairs.set(OverlappingPair::computeBodiesIndexPair(body1, body2));
|
m_noCollisionPairs.set(OverlappingPair::computeBodiesIndexPair(_body1, _body2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::removeNoCollisionPair(CollisionBody* body1,
|
void CollisionDetection::removeNoCollisionPair(CollisionBody* _body1, CollisionBody* _body2) {
|
||||||
CollisionBody* body2) {
|
m_noCollisionPairs.erase(m_noCollisionPairs.find(OverlappingPair::computeBodiesIndexPair(_body1, _body2)));
|
||||||
m_noCollisionPairs.erase(m_noCollisionPairs.find(OverlappingPair::computeBodiesIndexPair(body1, body2)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::askForBroadPhaseCollisionCheck(ProxyShape* shape) {
|
void CollisionDetection::askForBroadPhaseCollisionCheck(ProxyShape* _shape) {
|
||||||
m_broadPhaseAlgorithm.addMovedCollisionShape(shape->m_broadPhaseID);
|
m_broadPhaseAlgorithm.addMovedCollisionShape(_shape->m_broadPhaseID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::updateProxyCollisionShape(ProxyShape* shape, const AABB& aabb,
|
void CollisionDetection::updateProxyCollisionShape(ProxyShape* _shape, const AABB& _aabb, const vec3& _displacement, bool _forceReinsert) {
|
||||||
const vec3& displacement, bool forceReinsert) {
|
m_broadPhaseAlgorithm.updateProxyCollisionShape(_shape, _aabb, _displacement);
|
||||||
m_broadPhaseAlgorithm.updateProxyCollisionShape(shape, aabb, displacement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollisionDetection::raycast(RaycastCallback* raycastCallback,
|
void CollisionDetection::raycast(RaycastCallback* _raycastCallback, const Ray& _ray, unsigned short _raycastWithCategoryMaskBits) const {
|
||||||
const Ray& ray,
|
|
||||||
unsigned short raycastWithCategoryMaskBits) const {
|
|
||||||
PROFILE("CollisionDetection::raycast()");
|
PROFILE("CollisionDetection::raycast()");
|
||||||
RaycastTest rayCastTest(raycastCallback);
|
RaycastTest rayCastTest(_raycastCallback);
|
||||||
// Ask the broad-phase algorithm to call the testRaycastAgainstShape()
|
// Ask the broad-phase algorithm to call the testRaycastAgainstShape()
|
||||||
// callback method for each proxy shape hit by the ray in the broad-phase
|
// callback method for each proxy shape hit by the ray in the broad-phase
|
||||||
m_broadPhaseAlgorithm.raycast(ray, rayCastTest, raycastWithCategoryMaskBits);
|
m_broadPhaseAlgorithm.raycast(_ray, rayCastTest, _raycastWithCategoryMaskBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CollisionDetection::testAABBOverlap(const ProxyShape* shape1,
|
bool CollisionDetection::testAABBOverlap(const ProxyShape* _shape1, const ProxyShape* _shape2) const {
|
||||||
const ProxyShape* shape2) const {
|
|
||||||
// If one of the shape's body is not active, we return no overlap
|
// If one of the shape's body is not active, we return no overlap
|
||||||
if (!shape1->getBody()->isActive() || !shape2->getBody()->isActive()) {
|
if ( !_shape1->getBody()->isActive()
|
||||||
|
|| !_shape2->getBody()->isActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_broadPhaseAlgorithm.testOverlappingShapes(shape1, shape2);
|
return m_broadPhaseAlgorithm.testOverlappingShapes(_shape1, _shape2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CollisionWorld* CollisionDetection::getWorld() {
|
CollisionWorld* CollisionDetection::getWorld() {
|
||||||
|
@ -25,18 +25,14 @@ CollisionWorld::~CollisionWorld() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Create a collision body and add it to the world
|
CollisionBody* CollisionWorld::createCollisionBody(const etk::Transform3D& _transform) {
|
||||||
* @param transform etk::Transform3Dation mapping the local-space of the body to world-space
|
|
||||||
* @return A pointer to the body that has been created in the world
|
|
||||||
*/
|
|
||||||
CollisionBody* CollisionWorld::createCollisionBody(const etk::Transform3D& transform) {
|
|
||||||
// Get the next available body ID
|
// Get the next available body ID
|
||||||
bodyindex bodyID = computeNextAvailableBodyID();
|
bodyindex bodyID = computeNextAvailableBodyID();
|
||||||
// Largest index cannot be used (it is used for invalid index)
|
// Largest index cannot be used (it is used for invalid index)
|
||||||
EPHY_ASSERT(bodyID < UINT64_MAX, "index too big");
|
EPHY_ASSERT(bodyID < UINT64_MAX, "index too big");
|
||||||
// Create the collision body
|
// Create the collision body
|
||||||
CollisionBody* collisionBody = ETK_NEW(CollisionBody, transform, *this, bodyID);
|
CollisionBody* collisionBody = ETK_NEW(CollisionBody, _transform, *this, bodyID);
|
||||||
EPHY_ASSERT(collisionBody != nullptr, "empty Body collision");
|
EPHY_ASSERT(collisionBody != nullptr, "empty Body collision");
|
||||||
// Add the collision body to the world
|
// Add the collision body to the world
|
||||||
m_bodies.add(collisionBody);
|
m_bodies.add(collisionBody);
|
||||||
@ -44,186 +40,115 @@ CollisionBody* CollisionWorld::createCollisionBody(const etk::Transform3D& trans
|
|||||||
return collisionBody;
|
return collisionBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void CollisionWorld::destroyCollisionBody(CollisionBody* _collisionBody) {
|
||||||
* @brief Destroy a collision body
|
|
||||||
* @param collisionBody Pointer to the body to destroy
|
|
||||||
*/
|
|
||||||
void CollisionWorld::destroyCollisionBody(CollisionBody* collisionBody) {
|
|
||||||
|
|
||||||
// Remove all the collision shapes of the body
|
// Remove all the collision shapes of the body
|
||||||
collisionBody->removeAllCollisionShapes();
|
_collisionBody->removeAllCollisionShapes();
|
||||||
|
|
||||||
// Add the body ID to the list of free IDs
|
// Add the body ID to the list of free IDs
|
||||||
m_freeBodiesIDs.pushBack(collisionBody->getID());
|
m_freeBodiesIDs.pushBack(_collisionBody->getID());
|
||||||
|
|
||||||
// Remove the collision body from the list of bodies
|
// Remove the collision body from the list of bodies
|
||||||
m_bodies.erase(m_bodies.find(collisionBody));
|
m_bodies.erase(m_bodies.find(_collisionBody));
|
||||||
|
ETK_DELETE(CollisionBody, _collisionBody);
|
||||||
ETK_DELETE(CollisionBody, collisionBody);
|
_collisionBody = nullptr;
|
||||||
collisionBody = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the next available body ID
|
|
||||||
bodyindex CollisionWorld::computeNextAvailableBodyID() {
|
bodyindex CollisionWorld::computeNextAvailableBodyID() {
|
||||||
|
|
||||||
// Compute the body ID
|
// Compute the body ID
|
||||||
bodyindex bodyID;
|
bodyindex bodyID;
|
||||||
if (!m_freeBodiesIDs.empty()) {
|
if (!m_freeBodiesIDs.empty()) {
|
||||||
bodyID = m_freeBodiesIDs.back();
|
bodyID = m_freeBodiesIDs.back();
|
||||||
m_freeBodiesIDs.popBack();
|
m_freeBodiesIDs.popBack();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
bodyID = m_currentBodyID;
|
bodyID = m_currentBodyID;
|
||||||
m_currentBodyID++;
|
m_currentBodyID++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bodyID;
|
return bodyID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset all the contact manifolds linked list of each body
|
|
||||||
void CollisionWorld::resetContactManifoldListsOfBodies() {
|
void CollisionWorld::resetContactManifoldListsOfBodies() {
|
||||||
|
|
||||||
// For each rigid body of the world
|
// For each rigid body of the world
|
||||||
for (etk::Set<CollisionBody*>::Iterator it = m_bodies.begin(); it != m_bodies.end(); ++it) {
|
for (etk::Set<CollisionBody*>::Iterator it = m_bodies.begin(); it != m_bodies.end(); ++it) {
|
||||||
|
|
||||||
// Reset the contact manifold list of the body
|
// Reset the contact manifold list of the body
|
||||||
(*it)->resetContactManifoldsList();
|
(*it)->resetContactManifoldsList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if the AABBs of two bodies overlap
|
bool CollisionWorld::testAABBOverlap(const CollisionBody* _body1, const CollisionBody* _body2) const {
|
||||||
/**
|
|
||||||
* @param body1 Pointer to the first body to test
|
|
||||||
* @param body2 Pointer to the second body to test
|
|
||||||
* @return True if the AABBs of the two bodies overlap and false otherwise
|
|
||||||
*/
|
|
||||||
bool CollisionWorld::testAABBOverlap(const CollisionBody* body1,
|
|
||||||
const CollisionBody* body2) const {
|
|
||||||
|
|
||||||
// If one of the body is not active, we return no overlap
|
// If one of the body is not active, we return no overlap
|
||||||
if (!body1->isActive() || !body2->isActive()) return false;
|
if ( !_body1->isActive()
|
||||||
|
|| !_body2->isActive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Compute the AABBs of both bodies
|
// Compute the AABBs of both bodies
|
||||||
AABB body1AABB = body1->getAABB();
|
AABB body1AABB = _body1->getAABB();
|
||||||
AABB body2AABB = body2->getAABB();
|
AABB body2AABB = _body2->getAABB();
|
||||||
|
|
||||||
// Return true if the two AABBs overlap
|
// Return true if the two AABBs overlap
|
||||||
return body1AABB.testCollision(body2AABB);
|
return body1AABB.testCollision(body2AABB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and report collisions between a given shape and all the others
|
void CollisionWorld::testCollision(const ProxyShape* _shape, CollisionCallback* _callback) {
|
||||||
// shapes of the world.
|
|
||||||
/**
|
|
||||||
* @param shape Pointer to the proxy shape to test
|
|
||||||
* @param callback Pointer to the object with the callback method
|
|
||||||
*/
|
|
||||||
void CollisionWorld::testCollision(const ProxyShape* shape,
|
|
||||||
CollisionCallback* callback) {
|
|
||||||
|
|
||||||
// Reset all the contact manifolds lists of each body
|
// Reset all the contact manifolds lists of each body
|
||||||
resetContactManifoldListsOfBodies();
|
resetContactManifoldListsOfBodies();
|
||||||
|
|
||||||
// Create the sets of shapes
|
// Create the sets of shapes
|
||||||
etk::Set<uint32_t> shapes;
|
etk::Set<uint32_t> shapes;
|
||||||
shapes.add(shape->m_broadPhaseID);
|
shapes.add(_shape->m_broadPhaseID);
|
||||||
etk::Set<uint32_t> emptySet;
|
etk::Set<uint32_t> emptySet;
|
||||||
|
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
m_collisionDetection.testCollisionBetweenShapes(callback, shapes, emptySet);
|
m_collisionDetection.testCollisionBetweenShapes(_callback, shapes, emptySet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and report collisions between two given shapes
|
void CollisionWorld::testCollision(const ProxyShape* _shape1, const ProxyShape* _shape2, CollisionCallback* _callback) {
|
||||||
/**
|
|
||||||
* @param shape1 Pointer to the first proxy shape to test
|
|
||||||
* @param shape2 Pointer to the second proxy shape to test
|
|
||||||
* @param callback Pointer to the object with the callback method
|
|
||||||
*/
|
|
||||||
void CollisionWorld::testCollision(const ProxyShape* shape1,
|
|
||||||
const ProxyShape* shape2,
|
|
||||||
CollisionCallback* callback) {
|
|
||||||
|
|
||||||
// Reset all the contact manifolds lists of each body
|
// Reset all the contact manifolds lists of each body
|
||||||
resetContactManifoldListsOfBodies();
|
resetContactManifoldListsOfBodies();
|
||||||
|
|
||||||
// Create the sets of shapes
|
// Create the sets of shapes
|
||||||
etk::Set<uint32_t> shapes1;
|
etk::Set<uint32_t> shapes1;
|
||||||
shapes1.add(shape1->m_broadPhaseID);
|
shapes1.add(_shape1->m_broadPhaseID);
|
||||||
etk::Set<uint32_t> shapes2;
|
etk::Set<uint32_t> shapes2;
|
||||||
shapes2.add(shape2->m_broadPhaseID);
|
shapes2.add(_shape2->m_broadPhaseID);
|
||||||
|
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
m_collisionDetection.testCollisionBetweenShapes(callback, shapes1, shapes2);
|
m_collisionDetection.testCollisionBetweenShapes(_callback, shapes1, shapes2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and report collisions between a body and all the others bodies of the
|
void CollisionWorld::testCollision(const CollisionBody* _body, CollisionCallback* _callback) {
|
||||||
// world
|
|
||||||
/**
|
|
||||||
* @param body Pointer to the first body to test
|
|
||||||
* @param callback Pointer to the object with the callback method
|
|
||||||
*/
|
|
||||||
void CollisionWorld::testCollision(const CollisionBody* body,
|
|
||||||
CollisionCallback* callback) {
|
|
||||||
|
|
||||||
// Reset all the contact manifolds lists of each body
|
// Reset all the contact manifolds lists of each body
|
||||||
resetContactManifoldListsOfBodies();
|
resetContactManifoldListsOfBodies();
|
||||||
|
|
||||||
// Create the sets of shapes
|
// Create the sets of shapes
|
||||||
etk::Set<uint32_t> shapes1;
|
etk::Set<uint32_t> shapes1;
|
||||||
|
|
||||||
// For each shape of the body
|
// For each shape of the body
|
||||||
for (const ProxyShape* shape=body->getProxyShapesList(); shape != nullptr;
|
for (const ProxyShape* shape = _body->getProxyShapesList();
|
||||||
|
shape != nullptr;
|
||||||
shape = shape->getNext()) {
|
shape = shape->getNext()) {
|
||||||
shapes1.add(shape->m_broadPhaseID);
|
shapes1.add(shape->m_broadPhaseID);
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Set<uint32_t> emptySet;
|
etk::Set<uint32_t> emptySet;
|
||||||
|
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
m_collisionDetection.testCollisionBetweenShapes(callback, shapes1, emptySet);
|
m_collisionDetection.testCollisionBetweenShapes(_callback, shapes1, emptySet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and report collisions between two bodies
|
void CollisionWorld::testCollision(const CollisionBody* _body1, const CollisionBody* _body2, CollisionCallback* _callback) {
|
||||||
/**
|
|
||||||
* @param body1 Pointer to the first body to test
|
|
||||||
* @param body2 Pointer to the second body to test
|
|
||||||
* @param callback Pointer to the object with the callback method
|
|
||||||
*/
|
|
||||||
void CollisionWorld::testCollision(const CollisionBody* body1,
|
|
||||||
const CollisionBody* body2,
|
|
||||||
CollisionCallback* callback) {
|
|
||||||
|
|
||||||
// Reset all the contact manifolds lists of each body
|
// Reset all the contact manifolds lists of each body
|
||||||
resetContactManifoldListsOfBodies();
|
resetContactManifoldListsOfBodies();
|
||||||
|
|
||||||
// Create the sets of shapes
|
// Create the sets of shapes
|
||||||
etk::Set<uint32_t> shapes1;
|
etk::Set<uint32_t> shapes1;
|
||||||
for (const ProxyShape* shape=body1->getProxyShapesList(); shape != nullptr;
|
for (const ProxyShape* shape = _body1->getProxyShapesList();
|
||||||
|
shape != nullptr;
|
||||||
shape = shape->getNext()) {
|
shape = shape->getNext()) {
|
||||||
shapes1.add(shape->m_broadPhaseID);
|
shapes1.add(shape->m_broadPhaseID);
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Set<uint32_t> shapes2;
|
etk::Set<uint32_t> shapes2;
|
||||||
for (const ProxyShape* shape=body2->getProxyShapesList(); shape != nullptr;
|
for (const ProxyShape* shape = _body2->getProxyShapesList();
|
||||||
|
shape != nullptr;
|
||||||
shape = shape->getNext()) {
|
shape = shape->getNext()) {
|
||||||
shapes2.add(shape->m_broadPhaseID);
|
shapes2.add(shape->m_broadPhaseID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
m_collisionDetection.testCollisionBetweenShapes(callback, shapes1, shapes2);
|
m_collisionDetection.testCollisionBetweenShapes(_callback, shapes1, shapes2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test and report collisions between all shapes of the world
|
void CollisionWorld::testCollision(CollisionCallback* _callback) {
|
||||||
/**
|
|
||||||
* @param callback Pointer to the object with the callback method
|
|
||||||
*/
|
|
||||||
void CollisionWorld::testCollision(CollisionCallback* callback) {
|
|
||||||
|
|
||||||
// Reset all the contact manifolds lists of each body
|
// Reset all the contact manifolds lists of each body
|
||||||
resetContactManifoldListsOfBodies();
|
resetContactManifoldListsOfBodies();
|
||||||
|
|
||||||
etk::Set<uint32_t> emptySet;
|
etk::Set<uint32_t> emptySet;
|
||||||
|
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
m_collisionDetection.testCollisionBetweenShapes(callback, emptySet, emptySet);
|
m_collisionDetection.testCollisionBetweenShapes(_callback, emptySet, emptySet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +60,16 @@ namespace ephysics {
|
|||||||
etk::Set<CollisionBody*>::Iterator getBodiesEndIterator() {
|
etk::Set<CollisionBody*>::Iterator getBodiesEndIterator() {
|
||||||
return m_bodies.end();
|
return m_bodies.end();
|
||||||
}
|
}
|
||||||
/// Create a collision body
|
/**
|
||||||
|
* @brief Create a collision body and add it to the world
|
||||||
|
* @param transform etk::Transform3Dation mapping the local-space of the body to world-space
|
||||||
|
* @return A pointer to the body that has been created in the world
|
||||||
|
*/
|
||||||
CollisionBody* createCollisionBody(const etk::Transform3D& transform);
|
CollisionBody* createCollisionBody(const etk::Transform3D& transform);
|
||||||
/// Destroy a collision body
|
/**
|
||||||
|
* @brief Destroy a collision body
|
||||||
|
* @param collisionBody Pointer to the body to destroy
|
||||||
|
*/
|
||||||
void destroyCollisionBody(CollisionBody* collisionBody);
|
void destroyCollisionBody(CollisionBody* collisionBody);
|
||||||
/**
|
/**
|
||||||
* @brief Set the collision dispatch configuration
|
* @brief Set the collision dispatch configuration
|
||||||
@ -85,7 +92,12 @@ namespace ephysics {
|
|||||||
unsigned short _raycastWithCategoryMaskBits = 0xFFFF) const {
|
unsigned short _raycastWithCategoryMaskBits = 0xFFFF) const {
|
||||||
m_collisionDetection.raycast(_raycastCallback, _ray, _raycastWithCategoryMaskBits);
|
m_collisionDetection.raycast(_raycastCallback, _ray, _raycastWithCategoryMaskBits);
|
||||||
}
|
}
|
||||||
/// Test if the AABBs of two bodies overlap
|
/**
|
||||||
|
* @brief Test if the AABBs of two bodies overlap
|
||||||
|
* @param _body1 Pointer to the first body to test
|
||||||
|
* @param _body2 Pointer to the second body to test
|
||||||
|
* @return True if the AABBs of the two bodies overlap and false otherwise
|
||||||
|
*/
|
||||||
bool testAABBOverlap(const CollisionBody* _body1,
|
bool testAABBOverlap(const CollisionBody* _body1,
|
||||||
const CollisionBody* _body2) const;
|
const CollisionBody* _body2) const;
|
||||||
/**
|
/**
|
||||||
@ -97,23 +109,42 @@ namespace ephysics {
|
|||||||
const ProxyShape* _shape2) const {
|
const ProxyShape* _shape2) const {
|
||||||
return m_collisionDetection.testAABBOverlap(_shape1, _shape2);
|
return m_collisionDetection.testAABBOverlap(_shape1, _shape2);
|
||||||
}
|
}
|
||||||
/// Test and report collisions between a given shape and all the others
|
/**
|
||||||
/// shapes of the world
|
* @brief Test and report collisions between a given shape and all the others shapes of the world.
|
||||||
|
* @param _shape Pointer to the proxy shape to test
|
||||||
|
* @param _callback Pointer to the object with the callback method
|
||||||
|
*/
|
||||||
virtual void testCollision(const ProxyShape* _shape,
|
virtual void testCollision(const ProxyShape* _shape,
|
||||||
CollisionCallback* _callback);
|
CollisionCallback* _callback);
|
||||||
/// Test and report collisions between two given shapes
|
/**
|
||||||
|
* @briefTest and report collisions between two given shapes
|
||||||
|
* @param _shape1 Pointer to the first proxy shape to test
|
||||||
|
* @param _shape2 Pointer to the second proxy shape to test
|
||||||
|
* @param _callback Pointer to the object with the callback method
|
||||||
|
*/
|
||||||
virtual void testCollision(const ProxyShape* _shape1,
|
virtual void testCollision(const ProxyShape* _shape1,
|
||||||
const ProxyShape* _shape2,
|
const ProxyShape* _shape2,
|
||||||
CollisionCallback* _callback);
|
CollisionCallback* _callback);
|
||||||
/// Test and report collisions between a body and all the others bodies of the
|
/**
|
||||||
/// world
|
* @brief Test and report collisions between a body and all the others bodies of the world.
|
||||||
|
* @param _body Pointer to the first body to test
|
||||||
|
* @param _callback Pointer to the object with the callback method
|
||||||
|
*/
|
||||||
virtual void testCollision(const CollisionBody* _body,
|
virtual void testCollision(const CollisionBody* _body,
|
||||||
CollisionCallback* _callback);
|
CollisionCallback* _callback);
|
||||||
/// Test and report collisions between two bodies
|
/**
|
||||||
|
* @brief Test and report collisions between two bodies
|
||||||
|
* @param _body1 Pointer to the first body to test
|
||||||
|
* @param _body2 Pointer to the second body to test
|
||||||
|
* @param _callback Pointer to the object with the callback method
|
||||||
|
*/
|
||||||
virtual void testCollision(const CollisionBody* _body1,
|
virtual void testCollision(const CollisionBody* _body1,
|
||||||
const CollisionBody* _body2,
|
const CollisionBody* _body2,
|
||||||
CollisionCallback* _callback);
|
CollisionCallback* _callback);
|
||||||
/// Test and report collisions between all shapes of the world
|
/**
|
||||||
|
* @brief Test and report collisions between all shapes of the world
|
||||||
|
* @param _callback Pointer to the object with the callback method
|
||||||
|
*/
|
||||||
virtual void testCollision(CollisionCallback* _callback);
|
virtual void testCollision(CollisionCallback* _callback);
|
||||||
friend class CollisionDetection;
|
friend class CollisionDetection;
|
||||||
friend class CollisionBody;
|
friend class CollisionBody;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user