Box2D 3.1.0
A 2D physics engine for games
Loading...
Searching...
No Matches
Collision

Functions for colliding pairs of shapes More...

Data Structures

struct  b2ManifoldPoint
 A manifold point is a contact point belonging to a contact manifold. More...
 
struct  b2Manifold
 A contact manifold describes the contact points between colliding shapes. More...
 

Functions

b2Manifold b2CollideCircles (const b2Circle *circleA, b2Transform xfA, const b2Circle *circleB, b2Transform xfB)
 Compute the contact manifold between two circles.
 
b2Manifold b2CollideCapsuleAndCircle (const b2Capsule *capsuleA, b2Transform xfA, const b2Circle *circleB, b2Transform xfB)
 Compute the contact manifold between a capsule and circle.
 
b2Manifold b2CollideSegmentAndCircle (const b2Segment *segmentA, b2Transform xfA, const b2Circle *circleB, b2Transform xfB)
 Compute the contact manifold between an segment and a circle.
 
b2Manifold b2CollidePolygonAndCircle (const b2Polygon *polygonA, b2Transform xfA, const b2Circle *circleB, b2Transform xfB)
 Compute the contact manifold between a polygon and a circle.
 
b2Manifold b2CollideCapsules (const b2Capsule *capsuleA, b2Transform xfA, const b2Capsule *capsuleB, b2Transform xfB)
 Compute the contact manifold between a capsule and circle.
 
b2Manifold b2CollideSegmentAndCapsule (const b2Segment *segmentA, b2Transform xfA, const b2Capsule *capsuleB, b2Transform xfB)
 Compute the contact manifold between an segment and a capsule.
 
b2Manifold b2CollidePolygonAndCapsule (const b2Polygon *polygonA, b2Transform xfA, const b2Capsule *capsuleB, b2Transform xfB)
 Compute the contact manifold between a polygon and capsule.
 
b2Manifold b2CollidePolygons (const b2Polygon *polygonA, b2Transform xfA, const b2Polygon *polygonB, b2Transform xfB)
 Compute the contact manifold between two polygons.
 
b2Manifold b2CollideSegmentAndPolygon (const b2Segment *segmentA, b2Transform xfA, const b2Polygon *polygonB, b2Transform xfB)
 Compute the contact manifold between an segment and a polygon.
 
b2Manifold b2CollideChainSegmentAndCircle (const b2ChainSegment *segmentA, b2Transform xfA, const b2Circle *circleB, b2Transform xfB)
 Compute the contact manifold between a chain segment and a circle.
 
b2Manifold b2CollideChainSegmentAndCapsule (const b2ChainSegment *segmentA, b2Transform xfA, const b2Capsule *capsuleB, b2Transform xfB, b2DistanceCache *cache)
 Compute the contact manifold between a chain segment and a capsule.
 
b2Manifold b2CollideChainSegmentAndPolygon (const b2ChainSegment *segmentA, b2Transform xfA, const b2Polygon *polygonB, b2Transform xfB, b2DistanceCache *cache)
 Compute the contact manifold between a chain segment and a rounded polygon.
 

Detailed Description

Functions for colliding pairs of shapes


Data Structure Documentation

◆ b2ManifoldPoint

struct b2ManifoldPoint

A manifold point is a contact point belonging to a contact manifold.

It holds details related to the geometry and dynamics of the contact points.

Collaboration diagram for b2ManifoldPoint:
Data Fields
b2Vec2 anchorA Location of the contact point relative to bodyA's origin in world space.
Note
When used internally to the Box2D solver, these are relative to the center of mass.
b2Vec2 anchorB Location of the contact point relative to bodyB's origin in world space.
uint16_t id Uniquely identifies a contact point between two shapes.
float maxNormalImpulse The maximum normal impulse applied during sub-stepping todo not sure this is needed.
float normalImpulse The impulse along the manifold normal vector.
float normalVelocity Relative normal velocity pre-solve.

Used for hit events. If the normal impulse is zero then there was no hit. Negative means shapes are approaching.

bool persisted Did this contact point exist the previous step?
b2Vec2 point Location of the contact point in world space.

Subject to precision loss at large coordinates.

Note
Should only be used for debugging.
float separation The separation of the contact point, negative if penetrating.
float tangentImpulse The friction impulse.

◆ b2Manifold

struct b2Manifold

A contact manifold describes the contact points between colliding shapes.

Collaboration diagram for b2Manifold:
Data Fields
b2Vec2 normal The unit normal vector in world space, points from shape A to bodyB.
int32_t pointCount The number of contacts points, will be 0, 1, or 2.
b2ManifoldPoint points[2] The manifold points, up to two are possible in 2D.