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 CollisionPairs, which should then be sent to a NarrowphaseDetector.

Narrow-phase

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

The 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.

Continuous Collision Detection (CCD) and Raycasting

The process outlined above is called discrete collision detection. Outside of this process, there's continuous collision detection and raycasting.

Continuous collision detection (CCD) is the process of detecting missed collisions that the discrete process couldn't detect. The discrete process fails to detect some collisions due to it being run on a set interval - if a sufficiently small object is going fast enough, for example. CCD 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:
4.0.0
Author:
William Bittle