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

Character movement solver. More...

Data Structures

struct  b2PlaneResult
 These are the collision planes returned from b2World_CollideMover. More...
 
struct  b2CollisionPlane
 These are collision planes that can be fed to b2SolvePlanes. More...
 
struct  b2PlaneSolverResult
 Result returned by b2SolvePlanes. More...
 

Functions

b2PlaneSolverResult b2SolvePlanes (b2Vec2 position, b2CollisionPlane *planes, int count)
 Solves the position of a mover that satisfies the given collision planes.
 
b2Vec2 b2ClipVector (b2Vec2 vector, const b2CollisionPlane *planes, int count)
 Clips the velocity against the given collision planes.
 

Detailed Description

Character movement solver.


Data Structure Documentation

◆ b2PlaneResult

struct b2PlaneResult

These are the collision planes returned from b2World_CollideMover.

Collaboration diagram for b2PlaneResult:
Data Fields
bool hit Did the collision register a hit? If not this plane should be ignored.
b2Plane plane The collision plane between the mover and a convex shape.

◆ b2CollisionPlane

struct b2CollisionPlane

These are collision planes that can be fed to b2SolvePlanes.

Normally this is assembled by the user from plane results in b2PlaneResult

Collaboration diagram for b2CollisionPlane:
Data Fields
bool clipVelocity Indicates if b2ClipVector should clip against this plane. Should be false for soft collision.
b2Plane plane The collision plane between the mover and some shape.
float push The push on the mover determined by b2SolvePlanes. Usually in meters.
float pushLimit Setting this to FLT_MAX makes the plane as rigid as possible.

Lower values can make the plane collision soft. Usually in meters.

◆ b2PlaneSolverResult

struct b2PlaneSolverResult

Result returned by b2SolvePlanes.

Collaboration diagram for b2PlaneSolverResult:
Data Fields
int iterationCount The number of iterations used by the plane solver. For diagnostics.
b2Vec2 position The final position of the mover.

Function Documentation

◆ b2ClipVector()

b2Vec2 b2ClipVector ( b2Vec2 vector,
const b2CollisionPlane * planes,
int count )

Clips the velocity against the given collision planes.

Planes with zero push or clipVelocity set to false are skipped.

◆ b2SolvePlanes()

b2PlaneSolverResult b2SolvePlanes ( b2Vec2 position,
b2CollisionPlane * planes,
int count )

Solves the position of a mover that satisfies the given collision planes.

Parameters
positionthis must be the position used to generate the collision planes
planesthe collision planes
countthe number of collision planes