|
@@ -360,6 +360,22 @@ Constraints can be turned on / off by calling Constraint::SetEnabled. After ever
|
|
|
|
|
|
# Collision Detection {#collision-detection}
|
|
# Collision Detection {#collision-detection}
|
|
|
|
|
|
|
|
+Collision detection can be performed through various interfaces:
|
|
|
|
+
|
|
|
|
+* Coarse collision detection against the world, using only the bounding box of each body is done through the BroadPhaseQuery interface (see PhysicsSystem::GetBroadPhaseQuery).
|
|
|
|
+* Detailed collision detection against the world is done through NarrowPhaseQuery interface (see PhysicsSystem::GetNarrowPhaseQuery).
|
|
|
|
+* Checking collisions with a single body is done through TransformedShape (see Body::GetTransformedShape)
|
|
|
|
+* Checking collisions against a single shape is done through various interfaces on the Shape class (see e.g. Shape::CastRay) or through the CollisionDispatch interface.
|
|
|
|
+
|
|
|
|
+The most common collision tests are:
|
|
|
|
+
|
|
|
|
+* Casting a ray: BroadPhaseQuery::CastRay, NarrowPhaseQuery::CastRay, TransformedShape::CastRay, Shape::CastRay.
|
|
|
|
+* Colliding a shape (e.g. a sphere) in a static position: NarrowPhaseQuery::CollideShape, TransformedShape::CollideShape, CollisionDispatch::sCollideShapeVsShape.
|
|
|
|
+* Casting a shape (sweeping it from a start to an end position and finding collisions along the way): NarrowPhaseQuery::CastShape, TransformedShape::CastShape, CollisionDispatch::sCastShapeVsShapeWorldSpace.
|
|
|
|
+* Checking if a shape contains a point: BroadPhaseQuery::CollidePoint, NarrowPhaseQuery::CollidePoint, TransformedShape::CollidePoint, Shape::CollidePoint.
|
|
|
|
+
|
|
|
|
+The following sections describe the collision detection system in more detail.
|
|
|
|
+
|
|
## Broad Phase {#broad-phase}
|
|
## Broad Phase {#broad-phase}
|
|
|
|
|
|
When bodies are added to the PhysicsSystem, they are inserted in the broad phase ([BroadPhaseQuadTree](@ref BroadPhaseQuadTree)). This provides quick coarse collision detection based on the axis aligned bounding box (AABB) of a body.
|
|
When bodies are added to the PhysicsSystem, they are inserted in the broad phase ([BroadPhaseQuadTree](@ref BroadPhaseQuadTree)). This provides quick coarse collision detection based on the axis aligned bounding box (AABB) of a body.
|