ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class computes the collision detection algorithms. More...
#include <include/reactphysics3d/systems/CollisionDetectionSystem.h>
Public Member Functions | |
CollisionDetectionSystem (PhysicsWorld *world, ColliderComponents &collidersComponents, TransformComponents &transformComponents, BodyComponents &bodyComponents, RigidBodyComponents &rigidBodyComponents, MemoryManager &memoryManager, HalfEdgeStructure &triangleHalfEdgeStructure) | |
Constructor. | |
~CollisionDetectionSystem ()=default | |
Destructor. | |
CollisionDetectionSystem (const CollisionDetectionSystem &collisionDetection)=delete | |
Deleted copy-constructor. | |
CollisionDetectionSystem & | operator= (const CollisionDetectionSystem &collisionDetection)=delete |
Deleted assignment operator. | |
CollisionDispatch & | getCollisionDispatch () |
Set the collision dispatch configuration. | |
void | addCollider (Collider *collider, const AABB &aabb) |
Add a collider to the collision detection. | |
void | removeCollider (Collider *collider) |
Remove a collider from the collision detection. | |
void | updateCollider (Entity colliderEntity) |
Update a collider (that has moved for instance) | |
void | updateColliders () |
Update all the enabled colliders. | |
void | addNoCollisionPair (Entity body1Entity, Entity body2Entity) |
Add a pair of bodies that cannot collide with each other. | |
void | removeNoCollisionPair (Entity body1Entity, Entity body2Entity) |
Remove a pair of bodies that cannot collide with each other. | |
void | askForBroadPhaseCollisionCheck (Collider *collider) |
Ask for a collision shape to be tested again during broad-phase. | |
void | notifyOverlappingPairsToTestOverlap (Collider *collider) |
Notify that the overlapping pairs where a given collider is involved need to be tested for overlap. | |
void | reportContactsAndTriggers () |
Report contacts and triggers. | |
void | computeCollisionDetection () |
Compute the collision detection. | |
void | raycast (RaycastCallback *raycastCallback, const Ray &ray, unsigned short raycastWithCategoryMaskBits) const |
Ray casting method. | |
bool | testOverlap (Body *body1, Body *body2) |
Return true if two bodies (collide) overlap. | |
void | testOverlap (Body *body, OverlapCallback &callback) |
Report all the bodies that overlap (collide) with the body in parameter. | |
void | testOverlap (OverlapCallback &overlapCallback) |
Report all the bodies that overlap (collide) in the world. | |
void | testCollision (Body *body1, Body *body2, CollisionCallback &callback) |
Test collision and report contacts between two bodies. | |
void | testCollision (Body *body, CollisionCallback &callback) |
Test collision and report all the contacts involving the body in parameter. | |
void | testCollision (CollisionCallback &callback) |
Test collision and report contacts between each colliding bodies in the world. | |
MemoryManager & | getMemoryManager () const |
Return a reference to the memory manager. | |
PhysicsWorld * | getWorld () |
Return a pointer to the world. | |
EventListener * | getWorldEventListener () |
Return the world event listener. | |
const AABB | getWorldAABB (const Collider *collider) const |
Return the world-space AABB of a given collider. | |
This class computes the collision detection algorithms.
We first perform a broad-phase algorithm to know which pairs of bodies can collide and then we run a narrow-phase algorithm to compute the collision contacts between bodies.
RP3D_FORCE_INLINE void reactphysics3d::CollisionDetectionSystem::askForBroadPhaseCollisionCheck | ( | Collider * | collider | ) |
Ask for a collision shape to be tested again during broad-phase.
We simply put the shape in the array of collision shape that have moved in the previous frame so that it is tested for collision again in the broad-phase.