Module org.dyn4j

Package org.dyn4j.collision

Package containing supporting classes to detect collisions between Convex Shapes.

Collision detection can be an expensive process. To avoid unnecessary processing a two phase approach to collision detection is used. First a inaccurate, yet conservative, algorithm is used to detect possible collision pairs. This process is called the broad-phase. Next, after obtaining all the possible collision pairs, each pair is tested using an accurate algorithm. This is called the narrow-phase. After the narrow-phase is complete, another phase, Manifold generation, generates the contact points.

Broad-phase

The BroadphaseDetectors will determine whether two Convex Shapes can possibly penetrate, returning only valid BroadphasePairs, which should then be sent to a NarrowphaseDetector.

Narrow-phase

The NarrowphaseDetectors will determine whether two Convex Shapes penetrate and return a Penetration.

A Penetration object represents the minimum distance along some vector required to push the Shapes out of the penetration.

The narrow-phase also contains classes for supporting multiple detectors at once via the FallbackNarrowphaseDetector class. Using the FallbackConditions the detector will determine whether to use the primary NarrowphaseDetector or the fallback.

Manifold Generation

Once a Penetration object is obtained, it should be passed to a ManifoldSolver. A ManifoldSolver will use the Penetration object and the given Convex Shapes to create a collision Manifold.

A collision Manifold represents the collision point(s) between the two Convex Shapes.

CCD and Raycasting

Outside of what's called discrete collision detection, there's continuous collision detection. This is the process of detecting (would be) missed collisions in the discrete process since it's only checking for collisions at instants in time. These detectors implement the TimeOfImpactDetector interface and return a TimeOfImpact object when a collision is detected.

This package also supports raycasting for both the broad and narrow phases. These detectors implement the RaycastDetector interface and return Raycast objects when a ray hits a Fixture.

The following is a list of implementations of the above interfaces:

Since:
1.0.0
Version:
3.2.0
Author:
William Bittle
Skip navigation links