Box3D 0.1.0
A 3D physics engine for games
Loading...
Searching...
No Matches
Character Mover

Character movement solver. More...

Data Structures

struct  b3PlaneResult
 The plane between a character mover and a shape. More...
struct  b3CollisionPlane
 These are collision planes that can be fed to b3SolvePlanes. More...
struct  b3PlaneSolverResult
 Result returned by b3SolvePlanes. More...
struct  b3BodyPlaneResult
 Body plane result for movers. More...

Typedefs

typedef bool b3PlaneResultFcn(b3ShapeId shapeId, const b3PlaneResult *plane, int planeCount, void *context)
 Used to collect collision planes for character movers.
typedef bool b3MoverFilterFcn(b3ShapeId shapeId, void *context)
 Used to filter shapes for shape casting character movers.

Functions

b3PlaneSolverResult b3SolvePlanes (b3Vec3 targetDelta, b3CollisionPlane *planes, int count)
 Solves the position of a mover that satisfies the given collision planes.
b3Vec3 b3ClipVector (b3Vec3 vector, const b3CollisionPlane *planes, int count)
 Clips the velocity against the given collision planes.

Detailed Description

Character movement solver.


Data Structure Documentation

◆ b3PlaneResult

struct b3PlaneResult

The plane between a character mover and a shape.

Collaboration diagram for b3PlaneResult:
Data Fields
b3Plane plane Outward pointing plane.
b3Vec3 point Closest point on the shape. May not be unique.

◆ b3CollisionPlane

struct b3CollisionPlane

These are collision planes that can be fed to b3SolvePlanes.

Normally this is assembled by the user from plane results in b3PlaneResult.

Collaboration diagram for b3CollisionPlane:
Data Fields
bool clipVelocity Indicates if b3ClipVector should clip against this plane. Should be false for soft collision.
b3Plane plane The collision plane between the mover and some shape.
float push The push on the mover determined by b3SolvePlanes. 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.

◆ b3PlaneSolverResult

struct b3PlaneSolverResult

Result returned by b3SolvePlanes.

Collaboration diagram for b3PlaneSolverResult:
Data Fields
b3Vec3 delta The final relative translation.
int iterationCount The number of iterations used by the plane solver. For diagnostics.

◆ b3BodyPlaneResult

struct b3BodyPlaneResult

Body plane result for movers.

Collaboration diagram for b3BodyPlaneResult:
Data Fields
b3PlaneResult result The plane result.
b3ShapeId shapeId The shape id on the body.

Typedef Documentation

◆ b3MoverFilterFcn

typedef bool b3MoverFilterFcn(b3ShapeId shapeId, void *context)

Used to filter shapes for shape casting character movers.

Return true to accept the collision

◆ b3PlaneResultFcn

typedef bool b3PlaneResultFcn(b3ShapeId shapeId, const b3PlaneResult *plane, int planeCount, void *context)

Used to collect collision planes for character movers.

Return true to continue gathering planes.

Function Documentation

◆ b3ClipVector()

b3Vec3 b3ClipVector ( b3Vec3 vector,
const b3CollisionPlane * planes,
int count )

Clips the velocity against the given collision planes.

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

◆ b3SolvePlanes()

b3PlaneSolverResult b3SolvePlanes ( b3Vec3 targetDelta,
b3CollisionPlane * planes,
int count )

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

Parameters
targetDeltathe desired translation from the position used to generate the collision planes
planesthe collision planes
countthe number of collision planes