Skip to main content

Module ffi

Module ffi 

Source

Structs§

__BindgenBitfieldUnit
b3AABB
Axis aligned bounding box.
b3BodyCastResult
Body cast result for ray and shape casts.
b3BodyDef
A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction. Body definitions are temporary objects used to bundle creation parameters. Must be initialized using b3DefaultBodyDef(). @ingroup body
b3BodyEvents
Body events are buffered in the world and are available as event arrays after the time step is complete. Note: this data becomes invalid if bodies are destroyed
b3BodyId
Body id references a body instance. This should be treated as an opaque handle.
b3BodyMoveEvent
Body move events triggered when a body moves. Triggered when a body moves due to simulation. Not reported for bodies moved by the user. This also has a flag to indicate that the body went to sleep so the application can also sleep that actor/entity/object associated with the body. On the other hand if the flag does not indicate the body went to sleep then the application can treat the actor/entity/object associated with the body as awake. This is an efficient way for an application to update game object transforms rather than calling functions such as b3Body_GetTransform() because this data is delivered as a contiguous array and it is only populated with bodies that have moved. @note If sleeping is disabled all dynamic and kinematic bodies will trigger move events.
b3BodyPlaneResult
Body plane result for movers.
b3BoxCastInput
Input for sweeping an AABB through a dynamic tree. The box is in the tree’s world float frame. The caller folds the cast shape radius and any world origin into the box, so the tree traversal stays a conservative box sweep and the precise narrow phase happens per shape in the callback.
b3BoxHull
Efficient box hull
b3Capacity
Optional world capacities that can be use to avoid run-time allocations @ingroup world
b3Capsule
A solid capsule can be viewed as two hemispheres connected by a rectangle.
b3CastOutput
Low level ray cast or shape-cast output data.
b3ChildShape
Child shape of a compound
b3CollisionPlane
These are collision planes that can be fed to b3SolvePlanes. Normally this is assembled by the user from plane results in b3PlaneResult.
b3CompoundCapsule
A capsule that lives in a compound.
b3CompoundCapsuleDef
Definition for a capsule in a compound shape.
b3CompoundData
The runtime data for a compound shape. This is a potentially large yet highly optimized data structure. It can contain thousands of child shapes, yet at runtime it populates into the world as a single shape in the runtime broad-phase. This data structure has data living off the end and must be accessed using offsets. Accessors are provided for user relevant data.
b3CompoundDef
Definition for creating a compound shape. All this data is fully cloned into the run-time compound shape.
b3CompoundHull
A hull that lives in a compound.
b3CompoundHullDef
Definition for a convex hull in a compound shape.
b3CompoundMesh
A mesh with non-uniform scale that lives in a compound.
b3CompoundMeshDef
Definition for a triangle mesh in a compound shape.
b3CompoundSphere
A sphere that lives in a compound.
b3CompoundSphereDef
Definition for a sphere in a compound shape.
b3ContactBeginTouchEvent
A begin-touch event is generated when two shapes begin touching.
b3ContactData
The contact data for two shapes. By convention the manifold normal points from shape A to shape B. @see b3Shape_GetContactData() and b3Body_GetContactData()
b3ContactEndTouchEvent
An end touch event is generated when two shapes stop touching. You will get an end event if you do anything that destroys contacts previous to the last world step. These include things like setting the transform, destroying a body or shape, or changing a filter or body type.
b3ContactEvents
Contact events are buffered in the world and are available as event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed
b3ContactHitEvent
A hit touch event is generated when two shapes collide with a speed faster than the hit speed threshold. This may be reported for speculative contacts that have a confirmed impulse.
b3ContactId
Contact id references a contact instance. This should be treated as an opaque handle.
b3CosSin
Cosine and sine pair. This uses a custom implementation designed for cross-platform determinism.
b3Counters
Counters that give details of the simulation size. @ingroup world
b3DebugDraw
This struct is passed to b3World_Draw to draw a debug view of the simulation world. Callbacks receive world coordinates. In large world mode the translation is double precision so it stays accurate far from the origin. Shift into your own camera frame inside the callbacks.
b3DebugShape
This is sent to the user for debug shape creation. The user should know the type in case they have custom sphere or capsule rendering.
b3DistanceInput
Input for b3ShapeDistance
b3DistanceJointDef
Distance joint definition. Connects a point on body A with a point on body B by a segment. Useful for ropes and springs. @ingroup distance_joint
b3DistanceOutput
Output for b3ShapeDistance
b3DynamicTree
The dynamic tree structure. This should be considered private data. It is placed here for performance reasons.
b3ExplosionDef
The explosion definition is used to configure options for explosions. Explosions consider shape geometry when computing the impulse. @ingroup world
b3FeaturePair
Contact points are always the result of two edges intersecting. It can be two edges of the same shape, which is just a shape vertex. Or a contact point can be the result of two edges crossing from different shapes. This is designed to support hull versus hull, but it is adapted to work with all shape types. The feature pair is used to identify contact points for temporal coherence and warm starting.
b3Filter
This is used to filter collision on shapes. It affects shape-vs-shape collision and shape-versus-query collision (such as b3World_CastRay). @ingroup shape
b3FilterJointDef
A filter joint is used to disable collision between two specific bodies. @ingroup filter_joint
b3HeightFieldData
A height field with compressed storage. @note This data structure has data hanging off the end and cannot be directly copied.
b3HeightFieldDef
Data used to create a height field
b3HullData
A convex hull. @note This data structure has data hanging off the end and cannot be directly copied.
b3HullFace
A hull face. Hulls use a half-edge data structure, so a face can be determined from a single half-edge index.
b3HullHalfEdge
Half-edge for hull data structure
b3HullVertex
A hull vertex. Identified by a half-edge with this vertex as its tail.
b3JointDef
Base joint definition used by all joint types. The local frames are measured from the body’s origin rather than the center of mass because:
b3JointEvent
Joint events report joints that are awake and have a force and/or torque exceeding the threshold The observed forces and torques are not returned for efficiency reasons.
b3JointEvents
Joint events are buffered in the world and are available as event arrays after the time step is complete. Note: this data becomes invalid if joints are destroyed
b3JointId
Joint id references a joint instance. This should be treated as an opaque handle.
b3LocalManifold
A local manifold with no dynamic information. Used by b3Collide functions.
b3LocalManifoldPoint
A local manifold point and normal in frame A.
b3Manifold
A contact manifold describes the contact points between colliding shapes. @note Box3D uses speculative collision so some contact points may be separated.
b3ManifoldPoint
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. Box3D uses speculative collision so some contact points may be separated. You may use the maxNormalImpulse to determine if there was an interaction during the time step.
b3MassData
This holds the mass data computed for a shape.
b3Matrix3
A 3x3 matrix.
b3Mesh
This allows mesh data to be re-used with different scales.
b3MeshData
This is a sorted triangle collision bounding volume hierarchy. @note This struct has data hanging off the end and cannot be directly copied.
b3MeshDef
This is used to create a re-usable collision mesh
b3MeshNode
A mesh BVH node.
b3MeshNode__bindgen_ty_1__bindgen_ty_1
Internal node
b3MeshNode__bindgen_ty_1__bindgen_ty_2
Leaf node
b3MeshTriangle
A mesh triangle.
b3MotionLocks
Motion locks to restrict the body movement @ingroup body
b3MotorJointDef
A motor joint is used to control the relative position and velocity between two bodies. @ingroup motor_joint
b3ParallelJointDef
Parallel joint definition. Constrains the angle between axis z in body A and axis z in body B using a spring. Useful to keep a body upright. @ingroup parallel_joint
b3Plane
A plane. separation = dot(normal, point) - offset
b3PlaneResult
The plane between a character mover and a shape
b3PlaneSolverResult
Result returned by b3SolvePlanes.
b3PrismaticJointDef
Prismatic joint definition. Body B may slide along the x-axis in local frame A. Body B cannot rotate relative to body A. The joint translation is zero when the local frame origins coincide in world space. @ingroup prismatic_joint
b3Profile
! @cond Profiling data. Times are in milliseconds. @ingroup world
b3Quat
A quaternion.
b3QueryFilter
The query filter is used to filter collisions between queries and shapes. For example, you may want a ray-cast representing a projectile to hit players and the static environment but not debris.
b3RayCastInput
Low level ray cast input data.
b3RayResult
Result from b3World_RayCastClosest.
b3RecPlayer
b3RecPlayerInfo
Summary of a recording, read once at open so a viewer can frame and label it.
b3RecQueryHit
One result of a recorded spatial query.
b3RecQueryInfo
A spatial query recorded during a replayed frame, exposed for inspection.
b3Recording
b3RevoluteJointDef
Revolute joint definition. A point on body B is fixed to a point on body A. Allows relative rotation about the z-axis. @ingroup revolute_joint
b3SATCache
Separating axis test cache. Provides temporal acceleration of collision routines.
b3SegmentDistanceResult
The closest points between to segments or infinite lines.
b3SensorBeginTouchEvent
A begin-touch event is generated when a shape starts to overlap a sensor shape.
b3SensorEndTouchEvent
An end touch event is generated when a shape stops overlapping a sensor shape. These include things like setting the transform, destroying a body or shape, or changing a filter. You will also get an end event if the sensor or visitor are destroyed. Therefore you should always confirm the shape id is valid using b3Shape_IsValid.
b3SensorEvents
Sensor events are buffered in the world and are available as begin/end overlap event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed
b3ShapeCastInput
Low level shape cast input in generic form. This allows casting an arbitrary point cloud wrap with a radius. For example, a sphere is a single point with a non-zero radius. A capsule is two points with a non-zero radius. A box is four points with a zero radius.
b3ShapeCastPairInput
Input parameters for b3ShapeCast
b3ShapeDef
Used to create a shape @ingroup shape
b3ShapeId
Shape id references a shape instance. This should be treated as an opaque handle.
b3ShapeProxy
A shape proxy is used by the GJK algorithm. It can represent a convex shape.
b3Simplex
Simplex from the GJK algorithm
b3SimplexCache
Used to warm start the GJK simplex. If you call this function multiple times with nearby transforms this might improve performance. Otherwise you can zero initialize this. The distance cache must be initialized to zero on the first call. Users should generally just zero initialize this structure for each call.
b3SimplexVertex
Simplex vertex for debugging the GJK algorithm
b3Sphere
A solid sphere
b3SphericalJointDef
Spherical joint definition. A point on body B is fixed to a point on body A. Allows rotation about the shared point. @ingroup spherical_joint
b3SurfaceMaterial
Material properties supported per triangle on meshes and height fields @ingroup shape
b3Sweep
This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.
b3TOIInput
Time of impact input
b3TOIOutput
Time of impact output
b3Transform
A rigid transform.
b3TreeNode
A node in the dynamic tree. This is private data placed here for performance reasons. todo test padding to 64 bytes to avoid straddling cache lines
b3TreeNodeChildren
Tree node child indices. For internal usage.
b3TreeStats
These are performance results returned by dynamic tree queries.
b3Vec2
A 2D vector.
b3Vec3
A 3D vector.
b3Version
Version numbering scheme. See https://semver.org/
b3WeldJointDef
Weld joint definition Connects two bodies together rigidly. This constraint provides springs to mimic soft-body simulation. @note The approximate solver in Box3D cannot hold many bodies together rigidly @ingroup weld_joint
b3WheelJointDef
Wheel joint definition Body A is the chassis and body B is the wheel. The wheel rotates around the local z-axis in frame B. The wheel translates along the local x-axis in frame A. The wheel can optionally steer along the x-axis in frame A. @ingroup wheel_joint
b3WorldDef
World definition used to create a simulation world. Must be initialized using b3DefaultWorldDef. @ingroup world
b3WorldId
World id references a world instance. This should be treated as an opaque handle.

Constants§

B3_AABB_MARGIN_FRACTION
B3_BODY_NAME_LENGTH
B3_CHILD_POWER
B3_COMPOUND_VERSION
B3_CONTACT_MANIFOLD_COUNT_BUCKETS
B3_CONTACT_RECYCLE_ANGULAR_DISTANCE
B3_DEG_TO_RAD
B3_DYNAMIC_TREE_VERSION
B3_ENABLE_VALIDATION
B3_GRAPH_COLOR_COUNT
B3_HASH_INIT
B3_HEIGHT_FIELD_HOLE
B3_HEIGHT_FIELD_VERSION
B3_HULL_VERSION
B3_MAX_CHILD_SHAPES
B3_MAX_COMPOUND_MESH_MATERIALS
B3_MAX_MANIFOLD_POINTS
B3_MAX_ROTATION
B3_MAX_SHAPES
B3_MAX_SHAPE_CAST_POINTS
B3_MAX_TASKS
B3_MAX_WORKERS
B3_MAX_WORLDS
B3_MESH_VERSION
B3_MIN_SCALE
B3_NULL_INDEX
B3_PI
B3_RAD_TO_DEG
B3_SHAPE_NAME_LENGTH
B3_SHAPE_POWER
B3_TIME_TO_SLEEP
b3BodyType_b3_bodyTypeCount
number of body types
b3BodyType_b3_dynamicBody
positive mass, velocity determined by forces, moved by solver
b3BodyType_b3_kinematicBody
zero mass, velocity set by user, moved by solver
b3BodyType_b3_staticBody
zero mass, zero velocity, may be manually moved
b3DebugMaterial_b3_debugMaterialDead
b3DebugMaterial_b3_debugMaterialDefault
b3DebugMaterial_b3_debugMaterialGlossy
b3DebugMaterial_b3_debugMaterialMatte
b3DebugMaterial_b3_debugMaterialMetallic
b3DebugMaterial_b3_debugMaterialSoft
b3HexColor_b3_colorAliceBlue
b3HexColor_b3_colorAntiqueWhite
b3HexColor_b3_colorAqua
b3HexColor_b3_colorAquamarine
b3HexColor_b3_colorAzure
b3HexColor_b3_colorBeige
b3HexColor_b3_colorBisque
b3HexColor_b3_colorBlack
b3HexColor_b3_colorBlanchedAlmond
b3HexColor_b3_colorBlue
b3HexColor_b3_colorBlueViolet
b3HexColor_b3_colorBox2DBlue
b3HexColor_b3_colorBox2DGreen
b3HexColor_b3_colorBox2DRed
b3HexColor_b3_colorBox2DYellow
b3HexColor_b3_colorBrown
b3HexColor_b3_colorBurlywood
b3HexColor_b3_colorCadetBlue
b3HexColor_b3_colorChartreuse
b3HexColor_b3_colorChocolate
b3HexColor_b3_colorCoral
b3HexColor_b3_colorCornflowerBlue
b3HexColor_b3_colorCornsilk
b3HexColor_b3_colorCrimson
b3HexColor_b3_colorCyan
b3HexColor_b3_colorDarkBlue
b3HexColor_b3_colorDarkCyan
b3HexColor_b3_colorDarkGoldenRod
b3HexColor_b3_colorDarkGray
b3HexColor_b3_colorDarkGreen
b3HexColor_b3_colorDarkKhaki
b3HexColor_b3_colorDarkMagenta
b3HexColor_b3_colorDarkOliveGreen
b3HexColor_b3_colorDarkOrange
b3HexColor_b3_colorDarkOrchid
b3HexColor_b3_colorDarkRed
b3HexColor_b3_colorDarkSalmon
b3HexColor_b3_colorDarkSeaGreen
b3HexColor_b3_colorDarkSlateBlue
b3HexColor_b3_colorDarkSlateGray
b3HexColor_b3_colorDarkTurquoise
b3HexColor_b3_colorDarkViolet
b3HexColor_b3_colorDeepPink
b3HexColor_b3_colorDeepSkyBlue
b3HexColor_b3_colorDimGray
b3HexColor_b3_colorDodgerBlue
b3HexColor_b3_colorFireBrick
b3HexColor_b3_colorFloralWhite
b3HexColor_b3_colorForestGreen
b3HexColor_b3_colorFuchsia
b3HexColor_b3_colorGainsboro
b3HexColor_b3_colorGhostWhite
b3HexColor_b3_colorGold
b3HexColor_b3_colorGoldenRod
b3HexColor_b3_colorGray
b3HexColor_b3_colorGreen
b3HexColor_b3_colorGreenYellow
b3HexColor_b3_colorHoneyDew
b3HexColor_b3_colorHotPink
b3HexColor_b3_colorIndianRed
b3HexColor_b3_colorIndigo
b3HexColor_b3_colorIvory
b3HexColor_b3_colorKhaki
b3HexColor_b3_colorLavender
b3HexColor_b3_colorLavenderBlush
b3HexColor_b3_colorLawnGreen
b3HexColor_b3_colorLemonChiffon
b3HexColor_b3_colorLightBlue
b3HexColor_b3_colorLightCoral
b3HexColor_b3_colorLightCyan
b3HexColor_b3_colorLightGoldenRodYellow
b3HexColor_b3_colorLightGray
b3HexColor_b3_colorLightGreen
b3HexColor_b3_colorLightPink
b3HexColor_b3_colorLightSalmon
b3HexColor_b3_colorLightSeaGreen
b3HexColor_b3_colorLightSkyBlue
b3HexColor_b3_colorLightSlateGray
b3HexColor_b3_colorLightSteelBlue
b3HexColor_b3_colorLightYellow
b3HexColor_b3_colorLime
b3HexColor_b3_colorLimeGreen
b3HexColor_b3_colorLinen
b3HexColor_b3_colorMagenta
b3HexColor_b3_colorMaroon
b3HexColor_b3_colorMediumAquaMarine
b3HexColor_b3_colorMediumBlue
b3HexColor_b3_colorMediumOrchid
b3HexColor_b3_colorMediumPurple
b3HexColor_b3_colorMediumSeaGreen
b3HexColor_b3_colorMediumSlateBlue
b3HexColor_b3_colorMediumSpringGreen
b3HexColor_b3_colorMediumTurquoise
b3HexColor_b3_colorMediumVioletRed
b3HexColor_b3_colorMidnightBlue
b3HexColor_b3_colorMintCream
b3HexColor_b3_colorMistyRose
b3HexColor_b3_colorMoccasin
b3HexColor_b3_colorNavajoWhite
b3HexColor_b3_colorNavy
b3HexColor_b3_colorOldLace
b3HexColor_b3_colorOlive
b3HexColor_b3_colorOliveDrab
b3HexColor_b3_colorOrange
b3HexColor_b3_colorOrangeRed
b3HexColor_b3_colorOrchid
b3HexColor_b3_colorPaleGoldenRod
b3HexColor_b3_colorPaleGreen
b3HexColor_b3_colorPaleTurquoise
b3HexColor_b3_colorPaleVioletRed
b3HexColor_b3_colorPapayaWhip
b3HexColor_b3_colorPeachPuff
b3HexColor_b3_colorPeru
b3HexColor_b3_colorPink
b3HexColor_b3_colorPlum
b3HexColor_b3_colorPowderBlue
b3HexColor_b3_colorPurple
b3HexColor_b3_colorRebeccaPurple
b3HexColor_b3_colorRed
b3HexColor_b3_colorRosyBrown
b3HexColor_b3_colorRoyalBlue
b3HexColor_b3_colorSaddleBrown
b3HexColor_b3_colorSalmon
b3HexColor_b3_colorSandyBrown
b3HexColor_b3_colorSeaGreen
b3HexColor_b3_colorSeaShell
b3HexColor_b3_colorSienna
b3HexColor_b3_colorSilver
b3HexColor_b3_colorSkyBlue
b3HexColor_b3_colorSlateBlue
b3HexColor_b3_colorSlateGray
b3HexColor_b3_colorSnow
b3HexColor_b3_colorSpringGreen
b3HexColor_b3_colorSteelBlue
b3HexColor_b3_colorTan
b3HexColor_b3_colorTeal
b3HexColor_b3_colorThistle
b3HexColor_b3_colorTomato
b3HexColor_b3_colorTurquoise
b3HexColor_b3_colorViolet
b3HexColor_b3_colorWheat
b3HexColor_b3_colorWhite
b3HexColor_b3_colorWhiteSmoke
b3HexColor_b3_colorYellow
b3HexColor_b3_colorYellowGreen
b3JointType_b3_distanceJoint
b3JointType_b3_filterJoint
b3JointType_b3_motorJoint
b3JointType_b3_parallelJoint
b3JointType_b3_prismaticJoint
b3JointType_b3_revoluteJoint
b3JointType_b3_sphericalJoint
b3JointType_b3_weldJoint
b3JointType_b3_wheelJoint
b3MeshEdgeFlags_b3_allConcaveEdges
b3MeshEdgeFlags_b3_allFlatEdges
b3MeshEdgeFlags_b3_concaveEdge1
b3MeshEdgeFlags_b3_concaveEdge2
b3MeshEdgeFlags_b3_concaveEdge3
b3MeshEdgeFlags_b3_flatEdge1
b3MeshEdgeFlags_b3_flatEdge2
b3MeshEdgeFlags_b3_flatEdge3
b3MeshEdgeFlags_b3_inverseConcaveEdge1
b3MeshEdgeFlags_b3_inverseConcaveEdge2
b3MeshEdgeFlags_b3_inverseConcaveEdge3
b3RecQueryType_b3_recQueryCastMover
b3RecQueryType_b3_recQueryCastRay
b3RecQueryType_b3_recQueryCastRayClosest
b3RecQueryType_b3_recQueryCastShape
b3RecQueryType_b3_recQueryCollideMover
b3RecQueryType_b3_recQueryOverlapAABB
b3RecQueryType_b3_recQueryOverlapShape
b3SeparatingFeature_b3_backsideAxis
b3SeparatingFeature_b3_closestPointsAxis
b3SeparatingFeature_b3_edgePairAxis
b3SeparatingFeature_b3_faceAxisA
b3SeparatingFeature_b3_faceAxisB
b3SeparatingFeature_b3_invalidAxis
b3SeparatingFeature_b3_manualEdgePairAxis
These are for testing
b3SeparatingFeature_b3_manualFaceAxisA
These are for testing
b3SeparatingFeature_b3_manualFaceAxisB
These are for testing
b3ShapeType_b3_capsuleShape
A capsule is an extruded sphere
b3ShapeType_b3_compoundShape
A compound shape composed of up to 64K spheres, capsules, hulls, and meshes
b3ShapeType_b3_heightShape
A height field useful for terrain
b3ShapeType_b3_hullShape
A convex hull
b3ShapeType_b3_meshShape
A triangle soup
b3ShapeType_b3_shapeTypeCount
The number of shape types
b3ShapeType_b3_sphereShape
A sphere with an offset
b3TOIState_b3_toiStateFailed
b3TOIState_b3_toiStateHit
b3TOIState_b3_toiStateOverlapped
b3TOIState_b3_toiStateSeparated
b3TOIState_b3_toiStateUnknown
b3TreeNodeFlags_b3_allocatedNode
b3TreeNodeFlags_b3_enlargedNode
b3TreeNodeFlags_b3_leafNode
b3TriangleFeature_b3_featureEdge1
v1-v2
b3TriangleFeature_b3_featureEdge2
v2-v3
b3TriangleFeature_b3_featureEdge3
v3-v1
b3TriangleFeature_b3_featureHullFace
b3TriangleFeature_b3_featureNone
b3TriangleFeature_b3_featureTriangleFace
b3TriangleFeature_b3_featureVertex1
v3-v1
b3TriangleFeature_b3_featureVertex2
v3-v1
b3TriangleFeature_b3_featureVertex3
v3-v1

Functions§

b3Atan2
Compute an approximate arctangent in the range [-pi, pi] This is hand coded for cross-platform determinism. The atan2f function in the standard library is not cross-platform deterministic. Accurate to around 0.0023 degrees.
b3Body_ApplyAngularImpulse
Apply an angular impulse in world space. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the world angular impulse vector, usually in units of kgmm/s @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady torque, use a torque instead, which will work better with the sub-stepping solver.
b3Body_ApplyForce
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force The world force vector, usually in newtons (N) @param point The world position of the point of application @param wake Option to wake up the body
b3Body_ApplyForceToCenter
Apply a force to the center of mass. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force the world force vector, usually in newtons (N). @param wake also wake up the body
b3Body_ApplyLinearImpulse
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This optionally wakes the body. The impulse is ignored if the body is not awake. @param bodyId The body id @param impulse the world impulse vector, usually in Ns or kgm/s. @param point the world position of the point of application. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.
b3Body_ApplyLinearImpulseToCenter
Apply an impulse to the center of mass. This immediately modifies the velocity. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the world impulse vector, usually in Ns or kgm/s. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.
b3Body_ApplyMassFromShapes
This updates the mass properties to the sum of the mass properties of the shapes. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass. You may also use this when automatic mass computation has been disabled. You should call this regardless of body type.
b3Body_ApplyTorque
Apply a torque. This affects the angular velocity without affecting the linear velocity. This optionally wakes the body. The torque is ignored if the body is not awake. @param bodyId The body id @param torque the world torque vector, usually in N*m. @param wake also wake up the body
b3Body_CastRay
Cast a ray at a specific body using a specified body transform.
b3Body_CastShape
Cast a shape at a specific body using a specified body transform.
b3Body_CollideMover
Collide a character mover with a specific body using a specified body transform.
b3Body_ComputeAABB
Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin. If there are no shapes attached then the returned AABB is empty and centered on the body origin.
b3Body_Disable
Disable a body by removing it completely from the simulation. This is expensive.
b3Body_Enable
Enable a body by adding it to the simulation. This is expensive.
b3Body_EnableContactRecycling
Enable or disable contact recycling for this body. Contact recycling is a performance optimization that reuses contact manifolds when bodies move slightly. Disabling it can avoid ghost collisions on characters at the cost of higher per-step work. Existing contacts retain their prior setting; only contacts created after this call see the new value. @see b3BodyDef::enableContactRecycling
b3Body_EnableHitEvents
Enable/disable hit events on all shapes @see b3ShapeDef::enableHitEvents
b3Body_EnableSleep
Enable or disable sleeping for this body. If sleeping is disabled the body will wake.
b3Body_GetAngularDamping
Get the current angular damping.
b3Body_GetAngularVelocity
Get the angular velocity of a body in radians per second
b3Body_GetClosestPoint
Get the closest point on a body to a world target.
b3Body_GetContactCapacity
Get the maximum capacity required for retrieving all the touching contacts on a body
b3Body_GetContactData
Get the touching contact data for a body
b3Body_GetGravityScale
Get the current gravity scale
b3Body_GetInverseMass
Get the inverse mass of the body, usually in 1/kilograms
b3Body_GetJointCount
Get the number of joints on this body
b3Body_GetJoints
Get the joint ids for all joints on this body, up to the provided capacity @returns the number of joint ids stored in the user array
b3Body_GetLinearDamping
Get the current linear damping.
b3Body_GetLinearVelocity
Get the linear velocity of a body’s center of mass. Usually in meters per second.
b3Body_GetLocalCenterOfMass
Get the center of mass position of the body in local space
b3Body_GetLocalPoint
Get a local point on a body given a world point
b3Body_GetLocalPointVelocity
Get the linear velocity of a local point attached to a body. Usually in meters per second.
b3Body_GetLocalRotationalInertia
Get the rotational inertia of the body in local space, usually in kg*m^2
b3Body_GetLocalVector
Get a local vector on a body given a world vector
b3Body_GetMass
Get the mass of the body, usually in kilograms
b3Body_GetMassData
Get the mass data for a body
b3Body_GetMotionLocks
Get the motion locks for this body.
b3Body_GetName
Get the body name.
b3Body_GetPosition
Get the world position of a body. This is the location of the body origin.
b3Body_GetRotation
Get the world rotation of a body as a quaternion
b3Body_GetShapeCount
Get the number of shapes on this body
b3Body_GetShapes
Get the shape ids for all shapes on this body, up to the provided capacity. @returns the number of shape ids stored in the user array
b3Body_GetSleepThreshold
Get the sleep threshold, usually in meters per second.
b3Body_GetTransform
Get the world transform of a body.
b3Body_GetType
Get the body type: static, kinematic, or dynamic
b3Body_GetUserData
Get the user data stored in a body
b3Body_GetWorld
Get the world that owns this body
b3Body_GetWorldCenterOfMass
Get the center of mass position of the body in world space
b3Body_GetWorldInverseRotationalInertia
Get the inverse rotational inertia of the body in world space, usually in 1/kg*m^2
b3Body_GetWorldPoint
Get a world point on a body given a local point
b3Body_GetWorldPointVelocity
Get the linear velocity of a world point attached to a body. Usually in meters per second.
b3Body_GetWorldVector
Get a world vector on a body given a local vector
b3Body_IsAwake
@return true if this body is awake
b3Body_IsBullet
Is this body a bullet?
b3Body_IsContactRecyclingEnabled
Is contact recycling enabled on this body?
b3Body_IsEnabled
Returns true if this body is enabled
b3Body_IsSleepEnabled
Returns true if sleeping is enabled for this body
b3Body_IsValid
Body identifier validation. A valid body exists in a world and is non-null. This can be used to detect orphaned ids. Provides validation for up to 64K allocations.
b3Body_OverlapShape
Overlap a shape with a specific body using a specified body transform.
b3Body_SetAngularDamping
Adjust the angular damping. Normally this is set in b3BodyDef before creation.
b3Body_SetAngularVelocity
Set the angular velocity of a body in radians per second
b3Body_SetAwake
Wake a body from sleep. This wakes the entire island the body is touching. @warning Putting a body to sleep will put the entire island of bodies touching this body to sleep, which can be expensive and possibly unintuitive.
b3Body_SetBullet
Set this body to be a bullet. A bullet does continuous collision detection against dynamic bodies (but not other bullets).
b3Body_SetGravityScale
Adjust the gravity scale. Normally this is set in b3BodyDef before creation. @see b3BodyDef::gravityScale
b3Body_SetLinearDamping
Adjust the linear damping. Normally this is set in b3BodyDef before creation.
b3Body_SetLinearVelocity
Set the linear velocity of a body. Usually in meters per second.
b3Body_SetMassData
Override the body’s mass properties. Normally this is computed automatically using the shape geometry and density. This information is lost if a shape is added or removed or if the body type changes.
b3Body_SetMotionLocks
Set the motion locks on this body.
b3Body_SetName
Set the body name. Up to B3_BODY_NAME_LENGTH characters including null termination.
b3Body_SetSleepThreshold
Set the sleep threshold, usually in meters per second
b3Body_SetTargetTransform
Set the velocity to reach the given transform after a given time step. The result will be close but maybe not exact. This is meant for kinematic bodies. The target is not applied if the velocity would be below the sleep threshold. This will optionally wake the body if asleep, but only if the movement is significant.
b3Body_SetTransform
Set the world transform of a body. This acts as a teleport and is fairly expensive. @note Generally you should create a body with the intended transform. @see b3BodyDef::position and b3BodyDef::rotation
b3Body_SetType
Change the body type. This is an expensive operation. This automatically updates the mass properties regardless of the automatic mass setting.
b3Body_SetUserData
Set the user data for a body
b3ClipVector
Clips the velocity against the given collision planes. Planes with zero push or clipVelocity set to false are skipped.
b3CloneAndTransformHull
Clone and transform a hull. Supports non-uniform and mirroring scale.
b3CloneHull
Deep clone a hull.
b3CollideCapsuleAndSphere
Collide a capsule and a sphere.
b3CollideCapsuleAndTriangle
Collide a capsule and a triangle.
b3CollideCapsules
Collide two capsules.
b3CollideHullAndCapsule
Collide a hull and a capsule.
b3CollideHullAndSphere
Collide a hull and a sphere.
b3CollideHullAndTriangle
Collide a hull and a triangle.
b3CollideHulls
Collide two hulls.
b3CollideSphereAndTriangle
Collide a sphere and a triangle.
b3CollideSpheres
Collide two spheres.
b3ComputeCapsuleAABB
Compute the bounding box of a transformed capsule
b3ComputeCapsuleMass
Compute mass properties of a capsule
b3ComputeCompoundAABB
Compute the bounding box of a compound
b3ComputeCosSin
Compute the cosine and sine of an angle in radians. Implemented for cross-platform determinism.
b3ComputeHeightFieldAABB
Compute the bounding box of a transformed height-field
b3ComputeHullAABB
Compute the bounding box of a transformed hull
b3ComputeHullMass
Compute mass properties of a hull
b3ComputeMeshAABB
Compute the bounding box of a transformed mesh. Scale may be non-uniform and have negative components.
b3ComputeQuatBetweenUnitVectors
Find a quaternion that rotates one vector to another.
b3ComputeSphereAABB
Compute the bounding box of a transformed sphere
b3ComputeSphereMass
Compute mass properties of a sphere
b3Contact_GetData
Get the manifolds for a contact. The manifold may have no points if the contact is not touching.
b3Contact_IsValid
Contact identifier validation. Provides validation for up to 2^32 allocations.
b3ConvertBytesToCompound
Convert bytes to compound. This does not clone. The bytes must remain in scope while the compound is used. This is done to improve run-time performance and allow for instancing. The bytes are mutated to fixup pointers.
b3ConvertCompoundToBytes
If bytes is null then this returns the number of required bytes. This clones all the data into the bytes buffer. This is expected to run offline or asynchronously. This mutates the compound to nullify pointers, leaving the compound in an unusable state.
b3CreateBody
Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition on the stack and pass it as a pointer. @code{.c} b3BodyDef bodyDef = b3DefaultBodyDef(); b3BodyId myBodyId = b3CreateBody(myWorldId, &bodyDef); @endcode @warning This function is locked during callbacks.
b3CreateBoxMesh
Create a box mesh.
b3CreateCapsuleShape
Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape
b3CreateCompound
Create a compound shape. All input data in the definition is cloned into the resulting compound.
b3CreateCompoundShape
Compound shapes are only allowed on static bodies.
b3CreateCone
Create a tessellated cone as a hull.
b3CreateCylinder
Create a tessellated cylinder as a hull.
b3CreateDistanceJoint
Create a distance joint @see b3DistanceJointDef for details
b3CreateFilterJoint
Create a filter joint. @see b3FilterJointDef for details
b3CreateGrid
Create a grid as a height field.
b3CreateGridMesh
Create a grid mesh along the x and z axes. @param xCount the number of rows in the x direction @param zCount the number of rows in the z direction @param cellWidth the width of each cell @param materialCount the number of materials to generate @param identifyEdges compute adjacency information
b3CreateHeightField
Create a generic height field.
b3CreateHeightFieldShape
Create a height-field shape and attach it to a body. The shape definition is fully cloned but the height field is not. Contacts are not created until the next time step. Height field is only allowed on static bodies. @warning this holds reference to the input height field which must remain valid for the lifetime of this shape @return the shape id for accessing the shape
b3CreateHollowBoxMesh
Create a hollow box mesh.
b3CreateHull
Create a generic convex hull.
b3CreateHullShape
Create a convex hull shape and attach it to a body. The shape definition is fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape
b3CreateMesh
Create a generic mesh.
b3CreateMeshShape
Create a mesh hull shape and attach it to a body. The shape definition is fully cloned but the mesh is not. Contacts are not created until the next time step. Mesh collision only creates contacts on static bodies. @warning this holds reference to the input mesh data which must remain valid for the lifetime of this shape @return the shape id for accessing the shape
b3CreateMotorJoint
Create a motor joint @see b3MotorJointDef for details
b3CreateParallelJoint
Create a parallel joint @see b3ParallelJointDef for details
b3CreatePlatformMesh
Create a platform mesh. A truncated pyramid.
b3CreatePrismaticJoint
Create a prismatic (slider) joint. @see b3PrismaticJointDef for details
b3CreateRecording
Create a recording buffer with an optional initial byte capacity. Pass 0 to use the default (64 KiB). The buffer grows on demand. @return a new recording, owned by the caller
b3CreateRevoluteJoint
Create a revolute joint @see b3RevoluteJointDef for details
b3CreateRock
Create a rock shaped hull.
b3CreateSphereShape
Create a circle shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape
b3CreateSphericalJoint
Create a spherical joint @see b3SphericalJointDef for details
b3CreateTorusMesh
Create a torus mesh.
b3CreateTransformedHullShape
Create a convex hull shape and attach it to a body. The hull is cloned then transformed with scale applied first. Use this for non-uniform or mirrored scale or a baked local transform. The baked result is shared through the world hull database. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape
b3CreateWave
Create a wave grid as a height field.
b3CreateWaveMesh
Create a wave mesh along the x and z axes.
b3CreateWeldJoint
Create a weld joint @see b3WeldJointDef for details
b3CreateWheelJoint
Create a wheel joint. @see b3WheelJointDef for details.
b3CreateWorld
Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You may create up to 128 worlds. Each world is completely independent and may be simulated in parallel. @return the world id.
b3DefaultBodyDef
Use this to initialize your body definition @ingroup body
b3DefaultDebugDraw
Create a debug draw struct with default values.
b3DefaultDistanceJointDef
Use this to initialize your joint definition @ingroup distance_joint
b3DefaultExplosionDef
Use this to initialize your explosion definition @ingroup world
b3DefaultFilter
Use this to initialize your filter @ingroup shape
b3DefaultFilterJointDef
Use this to initialize your joint definition @ingroup filter_joint
b3DefaultMotorJointDef
Use this to initialize your joint definition @ingroup motor_joint
b3DefaultParallelJointDef
Use this to initialize your joint definition @ingroup parallel_joint
b3DefaultPrismaticJointDef
Use this to initialize your joint definition @ingroup prismatic_joint
b3DefaultQueryFilter
Use this to initialize your query filter
b3DefaultRevoluteJointDef
Use this to initialize your joint definition. @ingroup revolute_joint
b3DefaultShapeDef
Use this to initialize your shape definition @ingroup shape
b3DefaultSphericalJointDef
Use this to initialize your joint definition. @ingroup spherical_joint
b3DefaultSurfaceMaterial
Use this to initialize your surface material @ingroup shape
b3DefaultWeldJointDef
Use this to initialize your joint definition @ingroup weld_joint
b3DefaultWheelJointDef
Use this to initialize your joint definition @ingroup wheel_joint
b3DefaultWorldDef
Use this to initialize your world definition @ingroup world
b3DestroyBody
Destroy a rigid body given an id. This destroys all shapes and joints attached to the body. Do not keep references to the associated shapes and joints.
b3DestroyCompound
Destroy a compound shape.
b3DestroyHeightField
Destroy a height field.
b3DestroyHull
Destroy a hull.
b3DestroyJoint
Destroy a joint
b3DestroyMesh
Destroy a mesh.
b3DestroyRecording
Destroy a recording and free its buffer. @param recording may be NULL
b3DestroyShape
Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a body are destroyed at once. @see b3Body_ApplyMassFromShapes
b3DestroyWorld
Destroy a world
b3DistanceJoint_EnableLimit
Enable joint limit. The limit only works if the joint spring is enabled. Otherwise the joint is rigid and the limit has no effect.
b3DistanceJoint_EnableMotor
Enable/disable the distance joint motor
b3DistanceJoint_EnableSpring
Enable/disable the distance joint spring. When disabled the distance joint is rigid.
b3DistanceJoint_GetCurrentLength
Get the current length of a distance joint
b3DistanceJoint_GetLength
Get the rest length of a distance joint
b3DistanceJoint_GetMaxLength
Get the distance joint maximum length
b3DistanceJoint_GetMaxMotorForce
Get the distance joint maximum motor force, usually in newtons
b3DistanceJoint_GetMinLength
Get the distance joint minimum length
b3DistanceJoint_GetMotorForce
Get the distance joint current motor force, usually in newtons
b3DistanceJoint_GetMotorSpeed
Get the distance joint motor speed, usually in meters per second
b3DistanceJoint_GetSpringDampingRatio
Get the spring damping ratio
b3DistanceJoint_GetSpringForceRange
Get the force range for the spring.
b3DistanceJoint_GetSpringHertz
Get the spring Hertz
b3DistanceJoint_IsLimitEnabled
Is the distance joint limit enabled?
b3DistanceJoint_IsMotorEnabled
Is the distance joint motor enabled?
b3DistanceJoint_IsSpringEnabled
Is the distance joint spring enabled?
b3DistanceJoint_SetLength
Set the rest length of a distance joint @param jointId The id for a distance joint @param length The new distance joint length
b3DistanceJoint_SetLengthRange
Set the minimum and maximum length parameters of a distance joint
b3DistanceJoint_SetMaxMotorForce
Set the distance joint maximum motor force, usually in newtons
b3DistanceJoint_SetMotorSpeed
Set the distance joint motor speed, usually in meters per second
b3DistanceJoint_SetSpringDampingRatio
Set the spring damping ratio, non-dimensional
b3DistanceJoint_SetSpringForceRange
Set the force range for the spring.
b3DistanceJoint_SetSpringHertz
Set the spring stiffness in Hertz
b3DumpHeightData
Save input height data to a file
b3DynamicTree_BoxCast
Sweep an AABB through the tree. The box is in the tree’s world float frame and the callback re-differences each shape at full precision against the query origin. Used by the large world spatial queries so the tree traversal stays float while the narrow phase stays precise.
b3DynamicTree_Create
Constructing the tree initializes the node pool.
b3DynamicTree_CreateProxy
Create a proxy. Provide an AABB and a userData value.
b3DynamicTree_Destroy
Destroy the tree, freeing the node pool.
b3DynamicTree_DestroyProxy
Destroy a proxy. This asserts if the id is invalid.
b3DynamicTree_EnlargeProxy
Enlarge a proxy and enlarge ancestors as necessary.
b3DynamicTree_GetAreaRatio
Get the ratio of the sum of the node areas to the root area.
b3DynamicTree_GetByteCount
Get the number of bytes used by this tree
b3DynamicTree_GetCategoryBits
Get the category bits on a proxy.
b3DynamicTree_GetHeight
Get the height of the binary tree.
b3DynamicTree_GetProxyCount
Get the number of proxies created
b3DynamicTree_GetRootBounds
Get the bounding box that contains the entire tree
b3DynamicTree_Load
Load a file for debugging
b3DynamicTree_MoveProxy
Move a proxy to a new AABB by removing and reinserting into the tree.
b3DynamicTree_Query
Query an AABB for overlapping proxies. The callback function is called for each proxy that overlaps the supplied AABB. @return performance data
b3DynamicTree_QueryClosest
Query an AABB for the closest object. The callback function is called for each proxy that might be closest to the supplied point. @param tree the dynamic tree to query @param point the query point @param maskBits nodes are skipped if the bit-wise AND with the node category bits is zero @param requireAllBits nodes are skipped if the bit-wise AND with the node category bits does not equal the maskBits @param callback a user provided instance of b3TreeQueryClosestCallbackFcn @param context a user context object that is provided to the callback @param minDistanceSqr the initial and final minimum squared distance. Provide a small initial to restrict the search and improve performance. If the value is large this query has performance that scales linearly with the number of proxies and would be slower than a brute force search. @return performance data
b3DynamicTree_RayCast
Ray cast against the proxies in the tree. This relies on the callback to perform an exact ray cast in the case where the proxy contains a shape. The callback also performs any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. Bit-wise filtering using mask bits can greatly improve performance in some scenarios. However, this filtering may be approximate, so the user should still apply filtering to results. @param tree the dynamic tree to ray cast @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) @param maskBits bit mask test: bool accept = (maskBits & node->categoryBits) != 0; @param requireAllBits modifies bit mask test: bool accept = (maskBits & node->categoryBits) == maskBits; @param callback a callback function that is called for each proxy that is hit by the ray @param context user context that is passed to the callback @return performance data
b3DynamicTree_Rebuild
Rebuild the tree while retaining subtrees that haven’t changed. Returns the number of boxes sorted.
b3DynamicTree_Save
Save this tree to a file for debugging
b3DynamicTree_SetCategoryBits
Modify the category bits on a proxy. This is an expensive operation.
b3DynamicTree_Validate
Validate this tree. For testing.
b3DynamicTree_ValidateNoEnlarged
Validate this tree has no enlarged AABBs. For testing.
b3GetByteCount
Total bytes allocated by Box3D
b3GetCompoundCapsule
Access a child capsule by index.
b3GetCompoundChild
Get a child shape of a compound.
b3GetCompoundHull
Access a child hull by index.
b3GetCompoundMaterials
Access the compound material array.
b3GetCompoundMesh
Access a child mesh by index.
b3GetCompoundSphere
Access a child sphere by index.
b3GetGraphColor
Get the visualization color assigned to a constraint graph color slot. The last index (B3_GRAPH_COLOR_COUNT - 1) is the overflow color.
b3GetHeight
Get the height of the mesh BVH.
b3GetLengthUnitsPerMeter
Get the current length units per meter.
b3GetMaxWorldCount
Get the maximum number of simultaneous worlds that have been created
b3GetMilliseconds
Get the milliseconds passed from an initial tick value.
b3GetMillisecondsAndReset
Get the milliseconds passed from an initial tick value.
b3GetStallThreshold
Get the threshold for logging stalls.
b3GetSweepTransform
Evaluate the transform sweep at a specific time.
b3GetTicks
Get the absolute number of system ticks. The value is platform specific.
b3GetVersion
Get the current version of Box3D
b3GetWorldCount
Get the current number of worlds
b3Hash
b3InternalAssert
Internal assertion handler. Allows for host intervention.
b3IsBoundedAABB
Is this AABB reasonably close to the origin? See B3_HUGE.
b3IsDoublePrecision
@return true if the library was built with BOX3D_DOUBLE_PRECISION (large world mode)
b3IsSaneAABB
Is this AABB valid and reasonable?
b3IsValidAABB
Is this a valid bounding box? Not Nan or infinity. Upper bound greater than or equal to lower bound.
b3IsValidFloat
@return is this float valid (finite and not NaN).
b3IsValidMatrix3
Is this a valid matrix? Not NaN or infinity.
b3IsValidPlane
Is this a valid plane? Normal is a unit vector. Not Nan or infinity.
b3IsValidPosition
Is this a valid world position? Not NaN or infinity.
b3IsValidQuat
Is this a valid quaternion? Not NaN or infinity. Is normalized.
b3IsValidRay
Use this to ensure your ray cast input is valid and avoid internal assertions.
b3IsValidTransform
Is this a valid transform? Not NaN or infinity. Is normalized.
b3IsValidVec3
Is this a valid vector? Not NaN or infinity.
b3IsValidWorldTransform
Is this a valid world transform? Not NaN or infinity. Rotation is normalized.
b3Joint_GetAngularSeparation
Get the current angular separation error for this joint. Does not consider admissible movement. Usually in radians.
b3Joint_GetBodyA
Get body A id on a joint
b3Joint_GetBodyB
Get body B id on a joint
b3Joint_GetCollideConnected
Is collision allowed between connected bodies?
b3Joint_GetConstraintForce
Get the current constraint force for this joint
b3Joint_GetConstraintTorque
Get the current constraint torque for this joint
b3Joint_GetConstraintTuning
Get the joint constraint tuning. Advanced feature.
b3Joint_GetForceThreshold
Get the force threshold for joint events (Newtons)
b3Joint_GetLinearSeparation
Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters.
b3Joint_GetLocalFrameA
Get the local frame on bodyA
b3Joint_GetLocalFrameB
Get the local frame on bodyB
b3Joint_GetTorqueThreshold
Get the torque threshold for joint events (N-m)
b3Joint_GetType
Get the joint type
b3Joint_GetUserData
Get the user data on a joint
b3Joint_GetWorld
Get the world that owns this joint
b3Joint_IsValid
Joint identifier validation. Provides validation for up to 64K allocations.
b3Joint_SetCollideConnected
Toggle collision between connected bodies
b3Joint_SetConstraintTuning
Set the joint constraint tuning. Advanced feature. @param jointId the joint @param hertz the stiffness in Hertz (cycles per second) @param dampingRatio the non-dimensional damping ratio (one for critical damping)
b3Joint_SetForceThreshold
Set the force threshold for joint events (Newtons)
b3Joint_SetLocalFrameA
Set the local frame on bodyA
b3Joint_SetLocalFrameB
Set the local frame on bodyB
b3Joint_SetTorqueThreshold
Set the torque threshold for joint events (N-m)
b3Joint_SetUserData
Set the user data on a joint
b3Joint_WakeBodies
Wake the bodies connect to this joint
b3LineDistance
Compute the closest points on two infinite lines.
b3LoadHeightField
Create a height field by loading a previously saved height data
b3LoadRecordingFromFile
Load a recording from a file. Returns NULL on failure (file not found, wrong magic). The caller owns the returned recording and must destroy it with b3DestroyRecording. @param path file path to read
b3MakeBoxHull
Make a box as a hull. Do not call b3DestroyHull on this.
b3MakeCubeHull
Make a cube as a hull. Do not call b3DestroyHull on this.
b3MakeOffsetBoxHull
Make an offset box as a hull. Do not call b3DestroyHull on this.
b3MakeQuatFromMatrix
Extract a quaternion from a rotation matrix.
b3MakeScaledBoxHull
This makes a transformed box hull with post scaling. This is useful for boxes that are scaled in a level editor. Such scaling can have reflection and shear. In the case of shear the result may be approximate. If you need to support shear consider using b3CreateHull. Do not call b3DestroyHull on this. @param halfWidths positive half widths @param transform local transform of box @param postScale scale applied after the transform, may be negative
b3MakeTransformedBoxHull
Make a transformed box as a hull. Do not call b3DestroyHull on this. @param hx, hy, hz positive half widths @param transform local transform of box
b3MotorJoint_GetAngularDampingRatio
Get the spring angular damping ratio.
b3MotorJoint_GetAngularHertz
Get the spring angular hertz stiffness
b3MotorJoint_GetAngularVelocity
Get the desired relative angular velocity in radians per second
b3MotorJoint_GetLinearDampingRatio
Get the spring linear damping ratio.
b3MotorJoint_GetLinearHertz
Get the spring linear hertz stiffness
b3MotorJoint_GetLinearVelocity
Get the desired relative linear velocity in meters per second
b3MotorJoint_GetMaxSpringForce
Get the maximum spring force in newtons.
b3MotorJoint_GetMaxSpringTorque
Get the maximum spring torque in newtons * meters
b3MotorJoint_GetMaxVelocityForce
Get the motor joint maximum force, usually in newtons
b3MotorJoint_GetMaxVelocityTorque
Get the motor joint maximum torque, usually in newton-meters
b3MotorJoint_SetAngularDampingRatio
Set the spring angular damping ratio. Use 1.0 for critical damping.
b3MotorJoint_SetAngularHertz
Set the spring angular hertz stiffness
b3MotorJoint_SetAngularVelocity
Set the desired relative angular velocity in radians per second
b3MotorJoint_SetLinearDampingRatio
Set the spring linear damping ratio. Use 1.0 for critical damping.
b3MotorJoint_SetLinearHertz
Set the spring linear hertz stiffness
b3MotorJoint_SetLinearVelocity
Set the desired relative linear velocity in meters per second
b3MotorJoint_SetMaxSpringForce
Set the maximum spring force in newtons.
b3MotorJoint_SetMaxSpringTorque
Set the maximum spring torque in newtons * meters
b3MotorJoint_SetMaxVelocityForce
Set the motor joint maximum force, usually in newtons
b3MotorJoint_SetMaxVelocityTorque
Set the motor joint maximum torque, usually in newton-meters
b3OverlapCapsule
Overlap shape versus capsule
b3OverlapCompound
Overlap shape versus compound
b3OverlapHeightField
Overlap shape versus height field
b3OverlapHull
Overlap shape versus hull
b3OverlapMesh
Overlap shape versus mesh
b3OverlapSphere
Overlap shape versus sphere
b3ParallelJoint_GetMaxTorque
Get the maximum spring torque, usually in newton-meters
b3ParallelJoint_GetSpringDampingRatio
Get the spring damping ratio
b3ParallelJoint_GetSpringHertz
Get the spring Hertz
b3ParallelJoint_SetMaxTorque
Set the maximum spring torque, usually in newton-meters
b3ParallelJoint_SetSpringDampingRatio
Set the spring damping ratio, non-dimensional
b3ParallelJoint_SetSpringHertz
Set the spring stiffness in Hertz
b3PointToSegmentDistance
Compute the closest point on the segment a-b to the target q.
b3PrismaticJoint_EnableLimit
Enable/disable a prismatic joint limit
b3PrismaticJoint_EnableMotor
Enable/disable a prismatic joint motor
b3PrismaticJoint_EnableSpring
Enable/disable the joint spring.
b3PrismaticJoint_GetLowerLimit
Get the prismatic joint lower limit
b3PrismaticJoint_GetMaxMotorForce
Get the prismatic joint maximum motor force, usually in newtons
b3PrismaticJoint_GetMotorForce
Get the prismatic joint current motor force, usually in newtons
b3PrismaticJoint_GetMotorSpeed
Get the prismatic joint motor speed, usually in meters per second
b3PrismaticJoint_GetSpeed
Get the current joint translation speed, usually in meters per second.
b3PrismaticJoint_GetSpringDampingRatio
Get the prismatic spring damping ratio (non-dimensional)
b3PrismaticJoint_GetSpringHertz
Get the prismatic joint stiffness in Hertz
b3PrismaticJoint_GetTargetTranslation
Get the prismatic joint target translation. Usually in meters.
b3PrismaticJoint_GetTranslation
Get the current joint translation, usually in meters.
b3PrismaticJoint_GetUpperLimit
Get the prismatic joint upper limit
b3PrismaticJoint_IsLimitEnabled
Is the prismatic joint limit enabled?
b3PrismaticJoint_IsMotorEnabled
Is the prismatic joint motor enabled?
b3PrismaticJoint_IsSpringEnabled
Is the prismatic joint spring enabled or not?
b3PrismaticJoint_SetLimits
Set the prismatic joint limits
b3PrismaticJoint_SetMaxMotorForce
Set the prismatic joint maximum motor force, usually in newtons
b3PrismaticJoint_SetMotorSpeed
Set the prismatic joint motor speed, usually in meters per second
b3PrismaticJoint_SetSpringDampingRatio
Set the prismatic joint damping ratio (non-dimensional)
b3PrismaticJoint_SetSpringHertz
Set the prismatic joint stiffness in Hertz. This should usually be less than a quarter of the simulation rate. For example, if the simulation runs at 60Hz then the joint stiffness should be 15Hz or less.
b3PrismaticJoint_SetTargetTranslation
Set the prismatic joint target translation. Usually in meters.
b3QueryCompound
Query a compound shape for children that overlap an AABB.
b3QueryHeightField
Query a height field for triangles overlapping a bounding box in local space. May have false positives. Useful for debug draw. @param heightField the height field to query @param bounds the bounding box in local space @param fcn a user function to collect triangles @param context the context sent to the user function.
b3QueryMesh
Query a mesh for triangles overlapping a bounding box in local space. May have false positives. Useful for debug draw. @param mesh the mesh to query, includes scale @param bounds the bounding box in local space @param fcn a user function to collect triangles @param context the context sent to the user function.
b3RayCastCapsule
Ray cast versus capsule in local space. A zero length ray is a point query. Initial overlap reports a hit at the ray origin with zero fraction and zero normal.
b3RayCastCompound
Ray cast versus compound in local space. A zero length ray is a point query. Initial overlap with a child reports a hit at the ray origin with zero fraction and zero normal.
b3RayCastHeightField
Ray cast versus height field in local space. A thin surface with no interior, so there is no overlap case.
b3RayCastHollowSphere
Ray cast versus a hollow sphere shell in local space. Unlike the solid sphere a ray starting inside is not an overlap: it passes through and hits the far wall.
b3RayCastHull
Ray cast versus hull shape in local space. A zero length ray is a point query. Initial overlap reports a hit at the ray origin with zero fraction and zero normal.
b3RayCastMesh
Ray cast versus mesh in local space. A thin surface with no interior, so there is no overlap case.
b3RayCastSphere
Ray cast versus sphere in local space. A zero length ray is a point query. Initial overlap reports a hit at the ray origin with zero fraction and zero normal.
b3ReadBinaryFile
b3RecPlayer_Create
Create a player over a recording. Owns a private copy of the bytes. @param data pointer to recording bytes @param size byte count of the recording @param workerCount worker count for the replay world; pass 1 to match a serial recording. Replaying at a different count re-partitions the constraint graph, so the StateHash check becomes a cross-thread determinism test. Adjustable later with b3RecPlayer_SetWorkerCount. @return a new player, or NULL on bad header or deserialization failure
b3RecPlayer_Destroy
Destroy the player and free all memory. Restores the previous global length scale.
b3RecPlayer_DrawFrameQueries
Draw the spatial queries recorded during the most recently replayed frame, layered on top of the world. Call after b3World_Draw. NULL draw function pointers are skipped. @param player a valid player handle @param draw debug draw callbacks @param queryIndex index of the frame query to draw, or -1 to draw all of them @param selectedIndex index of the query to emphasize (reserved color plus a label), or -1 for none
b3RecPlayer_GetBodyCount
@return the number of bodies tracked in creation order (including holes for destroyed bodies)
b3RecPlayer_GetBodyId
Resolve a creation ordinal to the live body id at the current frame. @return the body id, or a null id if that ordinal is out of range or its body is destroyed
b3RecPlayer_GetDivergeFrame
@return the first frame at which replay diverged, or -1 if it has not diverged
b3RecPlayer_GetFrame
@return the last fully-stepped frame index (0 before any step)
b3RecPlayer_GetFrameCount
@return total number of recorded frames
b3RecPlayer_GetFrameQuery
Get a recorded query from the most recently replayed frame by index.
b3RecPlayer_GetFrameQueryCount
@return the number of spatial queries recorded for the most recently replayed frame
b3RecPlayer_GetFrameQueryHit
Get one result of a recorded query from the most recently replayed frame.
b3RecPlayer_GetInfo
@return a summary of the recording read at open: frame count, recorded tuning, and bounds
b3RecPlayer_GetKeyframeBudget
@return the keyframe memory budget in bytes
b3RecPlayer_GetKeyframeBytes
@return the memory currently held by keyframe snapshots, in bytes
b3RecPlayer_GetKeyframeInterval
@return the current keyframe spacing in frames; starts at the min interval and doubles as the ring evicts to stay under budget, so it reflects the effective backward-seek granularity now
b3RecPlayer_GetKeyframeMinInterval
@return the finest keyframe spacing in frames
b3RecPlayer_GetWorldId
@return the world currently driven by this player
b3RecPlayer_HasDiverged
@return true when any StateHash mismatch has been detected
b3RecPlayer_IsAtEnd
@return true when the op stream is exhausted
b3RecPlayer_Restart
Rewind to frame 0 (in-place restore so the world id stays stable).
b3RecPlayer_SeekFrame
Seek to a specific frame. Forward seek steps op-by-op; backward seek restores the nearest keyframe then re-steps the remaining gap.
b3RecPlayer_SetDebugShapeCallbacks
Wire host debug-shape callbacks into the player’s replay world so a renderer can build per-shape draw resources (the 3D sample needs this or the replay world draws nothing). Rebuilds the current world under the new callbacks and rewinds to frame 0, so call it once right after b3RecPlayer_Create and re-read the world id afterward. The callbacks persist across Restart and backward seeks, which recreate the world internally. @param player the player to configure @param createDebugShape called when a replayed shape is added; returns a user draw handle @param destroyDebugShape called when a replayed shape is removed; may be NULL @param context user context passed to both callbacks
b3RecPlayer_SetKeyframePolicy
Tune the keyframe ring used to speed up backward seeking. A keyframe is a periodic snapshot the player restores from instead of replaying from the start, trading memory for seek speed. @param player the recording player @param budgetBytes memory cap for the kept snapshots; the spacing widens to stay under it @param minIntervalFrames finest spacing between keyframes, in frames A zero budget or a non-positive interval keeps that value. Clears the existing ring, so call b3RecPlayer_Restart afterward to repopulate it under the new policy.
b3RecPlayer_SetWorkerCount
Set the worker count of the replay world. Clamped to [1, B3_MAX_WORKERS]. Applied to the live world at once and reused whenever the player rebuilds its world on Restart or a backward seek. Replaying at a different count than recorded re-partitions the constraint graph, so the StateHash check becomes a cross-thread determinism test.
b3RecPlayer_StepFrame
Advance one frame: dispatch ops until the next Step completes. @return true when a frame was stepped, false at end-of-recording
b3Recording_GetData
Get a pointer to the raw recording bytes. Valid until the recording buffer is modified or destroyed. @param recording the recording handle @return pointer to the byte buffer, or NULL if no bytes have been written
b3Recording_GetSize
Get the number of bytes currently in the recording buffer. @param recording the recording handle
b3RevoluteJoint_EnableLimit
Enable/disable the revolute joint limit
b3RevoluteJoint_EnableMotor
Enable/disable a revolute joint motor
b3RevoluteJoint_EnableSpring
Enable/disable the revolute joint spring
b3RevoluteJoint_GetAngle
Get the revolute joint current angle in radians relative to the reference angle @see b3RevoluteJointDef::referenceAngle
b3RevoluteJoint_GetLowerLimit
Get the revolute joint lower limit in radians
b3RevoluteJoint_GetMaxMotorTorque
Get the revolute joint maximum motor torque, usually in newton-meters
b3RevoluteJoint_GetMotorSpeed
Get the revolute joint motor speed in radians per second
b3RevoluteJoint_GetMotorTorque
Get the revolute joint current motor torque, usually in newton-meters
b3RevoluteJoint_GetSpringDampingRatio
Get the revolute joint spring damping ratio, non-dimensional
b3RevoluteJoint_GetSpringHertz
Get the revolute joint spring stiffness in Hertz
b3RevoluteJoint_GetTargetAngle
Get the revolute joint target angle in radians
b3RevoluteJoint_GetUpperLimit
Get the revolute joint upper limit in radians
b3RevoluteJoint_IsLimitEnabled
Is the revolute joint limit enabled?
b3RevoluteJoint_IsMotorEnabled
Is the revolute joint motor enabled?
b3RevoluteJoint_IsSpringEnabled
Is the revolute angular spring enabled?
b3RevoluteJoint_SetLimits
Set the revolute joint limits in radians
b3RevoluteJoint_SetMaxMotorTorque
Set the revolute joint maximum motor torque, usually in newton-meters
b3RevoluteJoint_SetMotorSpeed
Set the revolute joint motor speed in radians per second
b3RevoluteJoint_SetSpringDampingRatio
Set the revolute joint spring damping ratio, non-dimensional
b3RevoluteJoint_SetSpringHertz
Set the revolute joint spring stiffness in Hertz
b3RevoluteJoint_SetTargetAngle
Set the revolute joint target angle in radians
b3SaveRecordingToFile
Save the recording buffer to a file. Returns true on success. @param recording the recording to save @param path file path to write
b3ScaleBox
This takes a box with a transform and post scale and converts it into a box with the post scale resolved with new half-widths and transform. This accepts non-uniform and negative scale. This is approximate if there is shear. @param halfWidths [in/out] the box half widths @param transform [in/out] the box transform with rotation and translation @param postScale the post scale being applied to the box after the transform @param minHalfWidth the minimum half width after scale is applied
b3SegmentDistance
Compute the closest points on two line segments.
b3SetAllocator
This allows the user to override the allocation functions. These should be set during application startup.
b3SetAssertFcn
Override the default assert callback. @param assertFcn a non-null assert callback
b3SetLengthUnitsPerMeter
Box3D bases all length units on meters, but you may need different units for your game. You can set this value to use different units. This should be done at application startup and only modified once. Default value is 1. @warning This must be modified before any calls to Box3D
b3SetLogFcn
Override the default logging callback.
b3SetStallThreshold
Set the threshold for logging stalls.
b3ShapeCast
Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction. The query runs in frame A, so the hit point and normal are returned in frame A. Initially touching shapes are a miss.
b3ShapeCastCapsule
Shape cast versus a capsule. Initial overlap is treated as a miss.
b3ShapeCastCompound
Shape cast versus compound. Initial overlap is treated as a miss.
b3ShapeCastHeightField
Shape cast versus a height field. Initial overlap is treated as a miss.
b3ShapeCastHull
Shape cast versus a hull. Initial overlap is treated as a miss.
b3ShapeCastMesh
Shape cast versus a mesh. Initial overlap is treated as a miss.
b3ShapeCastSphere
Shape cast versus a sphere. Initial overlap is treated as a miss.
b3ShapeDistance
Compute the closest points between two shapes represented as point clouds. b3SimplexCache cache is input/output. On the first call set b3SimplexCache.count to zero. The query runs in frame A, so the witness points and normal are returned in frame A. The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these.
b3Shape_ApplyWind
Apply a wind force to the body for this shape using the density of air. This considers the projected area of the shape in the wind direction. This also considers the relative velocity of the shape. @param shapeId the shape id @param wind the wind velocity in world space @param drag the drag coefficient, the force that opposes the relative velocity @param lift the lift coefficient, the force that is perpendicular to the relative velocity @param maxSpeed the maximum relative speed. Speed cap is necessary for stability. Typically 10m/s or less. @param wake should this wake the body
b3Shape_AreContactEventsEnabled
Returns true if contact events are enabled
b3Shape_AreHitEventsEnabled
Returns true if hit events are enabled
b3Shape_ArePreSolveEventsEnabled
Returns true if pre-solve events are enabled
b3Shape_AreSensorEventsEnabled
Returns true if sensor events are enabled
b3Shape_ComputeMassData
Compute the mass data for a shape
b3Shape_EnableContactEvents
Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. @see b3ShapeDef::enableContactEvents
b3Shape_EnableHitEvents
Enable contact hit events for this shape. Ignored for sensors. @see b3WorldDef.hitEventThreshold
b3Shape_EnablePreSolveEvents
Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to multithreading. Ignored for sensors. @see b3PreSolveFcn
b3Shape_EnableSensorEvents
Enable sensor events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. @see b3ShapeDef::isSensor
b3Shape_GetAABB
Get the current world AABB
b3Shape_GetBody
Get the id of the body that a shape is attached to
b3Shape_GetCapsule
Get a copy of the shape’s capsule. Asserts the type is correct.
b3Shape_GetClosestPoint
Get the closest point on a shape to a target point. Target and result are in world space.
b3Shape_GetContactCapacity
Get the maximum capacity required for retrieving all the touching contacts on a shape
b3Shape_GetContactData
Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data. @note Box3D uses speculative collision so some contact points may be separated. @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements
b3Shape_GetDensity
Get the density of a shape, usually in kg/m^3
b3Shape_GetFilter
Get the shape filter
b3Shape_GetFriction
Get the friction of a shape
b3Shape_GetHeightField
Get the shape’s height field. Asserts the type is correct.
b3Shape_GetHull
Get the shape’s convex hull. Asserts the type is correct.
b3Shape_GetMesh
Get the shape’s mesh. Asserts the type is correct.
b3Shape_GetMeshMaterialCount
Get the number of mesh surface materials.
b3Shape_GetMeshSurfaceMaterial
Get a surface material for a mesh shape
b3Shape_GetRestitution
Get the shape restitution
b3Shape_GetSensorCapacity
Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape. This returns 0 if the provided shape is not a sensor. @param shapeId the id of a sensor shape @returns the required capacity to get all the overlaps in b3Shape_GetSensorOverlaps
b3Shape_GetSensorData
Get the overlap data for a sensor shape. @param shapeId the id of a sensor shape @param visitorIds a user allocated array that is filled with the overlapping shapes (visitors) @param capacity the capacity of overlappedShapes @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements @warning overlaps may contain destroyed shapes so use b3Shape_IsValid to confirm each overlap
b3Shape_GetSphere
Get a copy of the shape’s sphere. Asserts the type is correct.
b3Shape_GetSurfaceMaterial
Get the base shape surface material.
b3Shape_GetType
Get the type of a shape
b3Shape_GetUserData
Get the user data for a shape. This is useful when you get a shape id from an event or query.
b3Shape_GetWorld
Get the world that owns this shape
b3Shape_IsSensor
Returns true if the shape is a sensor
b3Shape_IsValid
Shape identifier validation. Provides validation for up to 64K allocations.
b3Shape_RayCast
Ray cast a shape directly. The ray runs from origin to origin + translation and the hit point comes back as a world position, so the cast stays precise far from the world origin.
b3Shape_SetCapsule
Allows you to change a shape to be a capsule or update the current capsule. This does not modify the mass properties. @see b3Body_ApplyMassFromShapes
b3Shape_SetDensity
Set the mass density of a shape, usually in kg/m^3. This will optionally update the mass properties on the parent body. @see b3ShapeDef::density, b3Body_ApplyMassFromShapes
b3Shape_SetFilter
Set the current filter. This is almost as expensive as recreating the shape. @see b3ShapeDef::filter @param shapeId the shape @param filter the new filter @param invokeContacts if true then the shape will have all contacts recomputed the next time step (expensive)
b3Shape_SetFriction
Set the friction on a shape
b3Shape_SetHull
Allows you to change a shape to be a hull or update the current hull. This does not modify the mass properties. @see b3Body_ApplyMassFromShapes
b3Shape_SetMesh
Allows you to change a shape to be a mesh or update the current mesh. This does not modify the mass properties. @see b3Body_ApplyMassFromShapes
b3Shape_SetMeshMaterial
Set a surface material for a mesh shape.
b3Shape_SetRestitution
Set the shape restitution (bounciness)
b3Shape_SetSphere
Allows you to change a shape to be a sphere or update the current sphere. This does not modify the mass properties. @see b3Body_ApplyMassFromShapes
b3Shape_SetSurfaceMaterial
Set the shape base surface material. Does not change per triangle materials.
b3Shape_SetUserData
Set the user data for a shape
b3Sleep
Sleep the current thread for a number of milliseconds.
b3SolvePlanes
Solves the position of a mover that satisfies the given collision planes. @param targetDelta the desired translation from the position used to generate the collision planes @param planes the collision planes @param count the number of collision planes
b3SphericalJoint_EnableConeLimit
Enable/disable the spherical joint cone limit
b3SphericalJoint_EnableMotor
Enable/disable a spherical joint motor
b3SphericalJoint_EnableSpring
Enable/disable the spherical joint spring
b3SphericalJoint_EnableTwistLimit
Enable/disable the spherical joint limit
b3SphericalJoint_GetConeAngle
Get the spherical joint current cone angle in radians.
b3SphericalJoint_GetConeLimit
Get the spherical joint cone limit in radians
b3SphericalJoint_GetLowerTwistLimit
Get the spherical joint lower limit in radians
b3SphericalJoint_GetMaxMotorTorque
Get the spherical joint maximum motor torque, usually in newton-meters
b3SphericalJoint_GetMotorTorque
Get the spherical joint current motor torque, usually in newton-meters
b3SphericalJoint_GetMotorVelocity
Get the spherical joint motor velocity in radians per second
b3SphericalJoint_GetSpringDampingRatio
Get the spherical joint spring damping ratio, non-dimensional
b3SphericalJoint_GetSpringHertz
Get the spherical joint spring stiffness in Hertz
b3SphericalJoint_GetTargetRotation
Get the spherical joint spring target rotation
b3SphericalJoint_GetTwistAngle
Get the spherical joint current twist angle in radians.
b3SphericalJoint_GetUpperTwistLimit
Get the spherical joint upper limit in radians
b3SphericalJoint_IsConeLimitEnabled
Is the spherical joint cone limit enabled?
b3SphericalJoint_IsMotorEnabled
Is the spherical joint motor enabled?
b3SphericalJoint_IsSpringEnabled
Is the spherical angular spring enabled?
b3SphericalJoint_IsTwistLimitEnabled
Is the spherical joint limit enabled?
b3SphericalJoint_SetConeLimit
Set the spherical joint limits in radians
b3SphericalJoint_SetMaxMotorTorque
Set the spherical joint maximum motor torque, usually in newton-meters
b3SphericalJoint_SetMotorVelocity
Set the spherical joint motor velocity in radians per second
b3SphericalJoint_SetSpringDampingRatio
Set the spherical joint spring damping ratio, non-dimensional
b3SphericalJoint_SetSpringHertz
Set the spherical joint spring stiffness in Hertz
b3SphericalJoint_SetTargetRotation
Set the spherical joint spring target rotation
b3SphericalJoint_SetTwistLimits
Set the spherical joint limits in radians
b3Steiner
Get the inertia tensor of an offset point. https://en.wikipedia.org/wiki/Parallel_axis_theorem
b3TimeOfImpact
Compute the upper bound on time before two shapes penetrate. Time is represented as a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, non-tunneling collisions. If you change the time interval, you should call this function again.
b3ValidateReplay
Replay a recording from memory and verify it reproduces the same world-state hashes. Stands up a fresh world, restores the seed snapshot, replays every op, and checks each embedded StateHash record. Returns true if replay completed without id mismatches or hash divergences. @param data pointer to recording bytes @param size byte count of the recording @param workerCount reserved for future multithreaded replay; pass 1 for now
b3WeldJoint_GetAngularDampingRatio
Get the weld joint angular damping ratio, non-dimensional
b3WeldJoint_GetAngularHertz
Get the weld joint angular stiffness in Hertz
b3WeldJoint_GetLinearDampingRatio
Get the weld joint linear damping ratio (non-dimensional)
b3WeldJoint_GetLinearHertz
Get the weld joint linear stiffness in Hertz
b3WeldJoint_SetAngularDampingRatio
Set weld joint angular damping ratio, non-dimensional
b3WeldJoint_SetAngularHertz
Set the weld joint angular stiffness in Hertz. 0 is rigid.
b3WeldJoint_SetLinearDampingRatio
Set the weld joint linear damping ratio (non-dimensional)
b3WeldJoint_SetLinearHertz
Set the weld joint linear stiffness in Hertz. 0 is rigid.
b3WheelJoint_EnableSpinMotor
Enable/disable the wheel joint motor.
b3WheelJoint_EnableSteering
Enable/disable wheel steering. Steering allows the wheel to rotate about the suspension axis.
b3WheelJoint_EnableSteeringLimit
Enable/disable the wheel joint steering limit.
b3WheelJoint_EnableSuspension
Enable/disable the wheel joint spring.
b3WheelJoint_EnableSuspensionLimit
Enable/disable the wheel joint limit.
b3WheelJoint_GetLowerSteeringLimit
Get the wheel joint lower steering limit in radians.
b3WheelJoint_GetLowerSuspensionLimit
Get the wheel joint lower limit.
b3WheelJoint_GetMaxSpinTorque
Get the wheel joint maximum motor torque, usually in newton-meters.
b3WheelJoint_GetMaxSteeringTorque
Get the wheel joint maximum steering torque in N*m.
b3WheelJoint_GetSpinMotorSpeed
Get the wheel joint motor speed in radians per second.
b3WheelJoint_GetSpinSpeed
Get the current spin speed in radians per second.
b3WheelJoint_GetSpinTorque
Get the wheel joint current motor torque, usually in newton-meters.
b3WheelJoint_GetSteeringAngle
Get the current steering angle in radians.
b3WheelJoint_GetSteeringDampingRatio
Get the wheel joint steering damping ratio, non-dimensional.
b3WheelJoint_GetSteeringHertz
Get the wheel joint steering stiffness in Hertz.
b3WheelJoint_GetSteeringTorque
Get the current steering torque in N*m.
b3WheelJoint_GetSuspensionDampingRatio
Get the wheel joint damping ratio, non-dimensional.
b3WheelJoint_GetSuspensionHertz
Get the wheel joint stiffness in Hertz.
b3WheelJoint_GetTargetSteeringAngle
Get the wheel joint target steering angle in radians.
b3WheelJoint_GetUpperSteeringLimit
Get the wheel joint upper steering limit in radians.
b3WheelJoint_GetUpperSuspensionLimit
Get the wheel joint upper limit.
b3WheelJoint_IsSpinMotorEnabled
Is the wheel joint motor enabled?
b3WheelJoint_IsSteeringEnabled
Can the wheel steer?
b3WheelJoint_IsSteeringLimitEnabled
Is the wheel joint steering limit enabled?
b3WheelJoint_IsSuspensionEnabled
Is the wheel joint spring enabled?
b3WheelJoint_IsSuspensionLimitEnabled
Is the wheel joint limit enabled?
b3WheelJoint_SetMaxSpinTorque
Set the wheel joint maximum motor torque, usually in newton-meters.
b3WheelJoint_SetMaxSteeringTorque
Set the wheel joint maximum steering torque in N*m.
b3WheelJoint_SetSpinMotorSpeed
Set the wheel joint motor speed in radians per second.
b3WheelJoint_SetSteeringDampingRatio
Set the wheel joint steering damping ratio, non-dimensional.
b3WheelJoint_SetSteeringHertz
Set the wheel joint steering stiffness in Hertz.
b3WheelJoint_SetSteeringLimits
Set the wheel joint steering limits in radians.
b3WheelJoint_SetSuspensionDampingRatio
Set the wheel joint damping ratio, non-dimensional.
b3WheelJoint_SetSuspensionHertz
Set the wheel joint stiffness in Hertz.
b3WheelJoint_SetSuspensionLimits
Set the wheel joint limits.
b3WheelJoint_SetTargetSteeringAngle
Set the wheel joint target steering angle in radians.
b3World_CastMover
Cast a capsule mover through the world. This is a special shape cast that handles sliding along other shapes while reducing clipping. This is not a good source of information about what the mover is touching. Instead use the planes returned by b3World_CollideMover. @param worldId World to cast the mover against @param origin World position the mover capsule is relative to @param mover Capsule mover, relative to the origin @param translation Desired mover translation @param filter Contains bit flags to filter unwanted shapes from the results @param fcn Optional callback for custom shape filtering @param context A user context that is passed along to the callback function @return the translation fraction
b3World_CastRay
Cast a ray into the world to collect shapes in the path of the ray. Your callback function controls whether you get the closest point, any point, or n-points. @note The callback function may receive shapes in any order @param worldId The world to cast the ray against @param origin The start point of the ray @param translation The translation of the ray from the start point to the end point @param filter Contains bit flags to filter unwanted shapes from the results @param fcn A user implemented callback function @param context A user context that is passed along to the callback function @return traversal performance counters
b3World_CastRayClosest
Cast a ray into the world to collect the closest hit. This is a convenience function. Ignores initial overlap. This is less general than b3World_CastRay() and does not allow for custom filtering.
b3World_CastShape
Cast a shape through the world. Similar to a cast ray except that a shape is cast instead of a point. The proxy points are relative to the origin and the hit points come back as world positions, so the cast stays precise far from the world origin. @see b3World_CastRay
b3World_CollideMover
Collide a capsule mover with the world, gathering collision planes that can be fed to b3SolvePlanes. Useful for kinematic character movement. The mover and the returned planes are relative to the origin.
b3World_Draw
Call this to draw shapes and other debug draw data
b3World_Dump
Dump world to a text file. Meshes are saved to binary b3m files.
b3World_DumpAwake
Dump world to a text file. Saves only awake bodies and associated static bodies. Meshes are saved to binary b3m files.
b3World_DumpMemoryStats
Dump memory stats to log.
b3World_DumpShapeBounds
Dump shape bounds to box3d_bounds.txt
b3World_EnableContinuous
Enable/disable continuous collision between dynamic and static bodies. Generally you should keep continuous collision enabled to prevent fast moving objects from going through static objects. The performance gain from disabling continuous collision is minor. @see b3WorldDef
b3World_EnableSleeping
Enable/disable sleep. If your application does not need sleeping, you can gain some performance by disabling sleep completely at the world level. @see b3WorldDef
b3World_EnableSpeculative
This is for internal testing
b3World_EnableWarmStarting
Enable/disable constraint warm starting. Advanced feature for testing. Disabling warm starting greatly reduces stability and provides no performance gain.
b3World_Explode
Apply a radial explosion @param worldId The world id @param explosionDef The explosion definition
b3World_GetAwakeBodyCount
Get the number of awake bodies
b3World_GetBodyEvents
Get the body events for the current time step. The event data is transient. Do not store a reference to this data.
b3World_GetBounds
Get the world’s bounds. This is the bounding box that covers the current simulation. May have a small amount of padding.
b3World_GetContactEvents
Get contact events for this current time step. The event data is transient. Do not store a reference to this data.
b3World_GetContactRecycleDistance
Get the contact point recycling distance. Usually in meters.
b3World_GetCounters
Get world counters and sizes
b3World_GetGravity
Get the gravity vector
b3World_GetHitEventThreshold
Get the hit event speed threshold. Usually in meters per second.
b3World_GetJointEvents
Get the joint events for the current time step. The event data is transient. Do not store a reference to this data.
b3World_GetMaxCapacity
Get max capacity. This can be used with b3WorldDef to avoid run-time allocations and copies
b3World_GetMaximumLinearSpeed
Get the maximum linear speed. Usually in m/s.
b3World_GetProfile
Get the current world performance profile
b3World_GetRestitutionThreshold
Get the restitution speed threshold. Usually in meters per second.
b3World_GetSensorEvents
Get sensor events for the current time step. The event data is transient. Do not store a reference to this data.
b3World_GetUserData
Get the user data pointer.
b3World_GetWorkerCount
Get the worker count.
b3World_IsContinuousEnabled
Is continuous collision enabled?
b3World_IsSleepingEnabled
Is body sleeping enabled?
b3World_IsValid
World id validation. Provides validation for up to 64K allocations.
b3World_IsWarmStartingEnabled
Is constraint warm starting enabled?
b3World_OverlapAABB
Overlap test for all shapes that potentially overlap the provided AABB
b3World_OverlapShape
Overlap test for all shapes that overlap the provided shape proxy. The proxy points are relative to the world origin, which lets the query stay precise far from the world origin.
b3World_RebuildStaticTree
This is for internal testing
b3World_SetContactRecycleDistance
Set the contact point recycling distance. Setting this to zero disables contact point recycling. Usually in meters.
b3World_SetContactTuning
Adjust contact tuning parameters @param worldId The world id @param hertz The contact stiffness (cycles per second) @param dampingRatio The contact bounciness with 1 being critical damping (non-dimensional) @param contactSpeed The maximum contact constraint push out speed (meters per second) @note Advanced feature
b3World_SetCustomFilterCallback
Register the custom filter callback. This is optional.
b3World_SetFrictionCallback
Set the friction callback. Passing NULL resets to default.
b3World_SetGravity
Set the gravity vector for the entire world. Box3D has no concept of an up direction and this is left as a decision for the application. Usually in m/s^2. @see b3WorldDef
b3World_SetHitEventThreshold
Adjust the hit event threshold. This controls the collision speed needed to generate a b3ContactHitEvent. Usually in meters per second. @see b3WorldDef::hitEventThreshold
b3World_SetMaximumLinearSpeed
Set the maximum linear speed. Usually in m/s.
b3World_SetPreSolveCallback
Register the pre-solve callback. This is optional.
b3World_SetRestitutionCallback
Set the restitution callback. Passing NULL resets to default.
b3World_SetRestitutionThreshold
Adjust the restitution threshold. It is recommended not to make this value very small because it will prevent bodies from sleeping. Usually in meters per second. @see b3WorldDef
b3World_SetUserData
Set the user data pointer.
b3World_SetWorkerCount
Set the worker count. Must be in the range [1, B3_MAX_WORKERS]
b3World_StartRecording
Begin recording world mutations into the provided buffer. The buffer is reset on each call so a single b3Recording can be reused for multiple sessions. @param worldId the world to record @param recording the recording handle to write into
b3World_Step
Simulate a world for one time step. This performs collision detection, integration, and constraint solution. @param worldId The world to simulate @param timeStep The amount of time to simulate, this should be a fixed number. Usually 1/60. @param subStepCount The number of sub-steps, increasing the sub-step count can increase accuracy. Usually 4.
b3World_StopRecording
End the current recording session. Writes the trailing geometry registry and backpatches the header. The buffer remains valid until the recording is destroyed. @param worldId the world currently being recorded
b3WriteBinaryFile
b3Yield
Yield to be used in a busy loop.

Type Aliases§

b3AllocFcn
Prototype for user allocation function. @param size the allocation size in bytes @param alignment the required alignment, guaranteed to be a power of 2
b3AssertFcn
Prototype for the user assert callback. Return 0 to skip the debugger break.
b3BodyType
The body simulation type. Each body is one of these three types. The type determines how the body behaves in the simulation. @ingroup body
b3CastResultFcn
Prototype callback for ray casts. Called for each shape found in the query. You control how the ray cast proceeds by returning a float: return -1: ignore this shape and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don’t clip the ray and continue @param shapeId the shape hit by the ray @param point the point of initial intersection @param normal the normal vector at the point of intersection @param fraction the fraction along the ray at the point of intersection @param userMaterialId the shape or triangle surface type @param triangleIndex the triangle index for mesh or height field shapes or -1 for other shape types @param childIndex the child shape index for compound shapes @param context the user context @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue @see b3World_CastRay @ingroup world
b3CompoundQueryFcn
Callback for compound overlap queries.
b3CreateDebugShapeCallback
The user needs to be able to create debug draw shapes for multi-pass rendering to work efficiently. These user shapes are created and destroyed via callback so they can be bound to shape lifetime and scaling updates. @ingroup debug_draw
b3CustomFilterFcn
Prototype for a contact filter callback. This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled. @see b3ShapeDef. Notes:
b3DebugMaterial
Debug draw material preset. Optionally packed into the unused high byte of a b3HexColor (or b3SurfaceMaterial::customColor) to drive the renderer’s PBR roughness and metalness. The low 24 bits stay RGB, so a plain 0xRRGGBB color reads as b3_debugMaterialDefault and keeps the renderer’s per-body-type look.
b3DestroyDebugShapeCallback
b3EnqueueTaskCallback
These functions can be provided to Box3D to invoke a task system. Returns a pointer to the user’s task object. May be nullptr. A nullptr indicates to Box3D that the work was executed serially within the callback and there is no need to call b3FinishTaskCallback. Otherwise the returned value must be non-null will be passed to b3FinishTaskCallback as the userTask. @param task the Box3D task to be called by the scheduler @param taskContext the Box3D context object that the scheduler must pass to the task @param userContext the scheduler context object that is opaque to Box3D @param taskName the Box3D task name that the scheduler can use for diagnostics @ingroup world
b3FinishTaskCallback
Finishes a user task object that wraps a Box3D task. This must block until the task has completed. The step blocks here on the tasks it spawned, so b3World_Step holds its stack across every fork/join. Drive it from a thread you can dedicate to the step, or from a fiber this callback can park to free the underlying thread. In a job system that cannot park a job’s stack, do not call b3World_Step from inside a job: a job that blocks on its own sub-jobs without yielding its thread can deadlock. The in-tree scheduler instead runs other pending tasks on the waiting thread. @ingroup world
b3FreeFcn
Prototype for user free function. @param mem the memory previously allocated through b3AllocFcn
b3FrictionCallback
Optional friction mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box3D state or user application state. @ingroup world
b3HexColor
These colors are used for debug draw and mostly match the named SVG colors. See https://www.rapidtables.com/web/color/index.html https://johndecember.com/html/spec/colorsvg.html https://upload.wikimedia.org/wikipedia/commons/2/2b/SVG_Recognized_color_keyword_names.svg
b3JointType
Joint type enumeration. This is useful because all joint types use b3JointId and sometimes you want to get the type of a joint. @ingroup joint
b3LogFcn
Prototype for user log callback. Used to log warnings.
b3MeshEdgeFlags
Triangle mesh edge flags.
b3MeshQueryFcn
Query callback.
b3MoverFilterFcn
Used to filter shapes for shape casting character movers. Return true to accept the collision
b3OverlapResultFcn
Prototype callback for overlap queries. Called for each shape found in the query. @see b3World_OverlapAABB @return false to terminate the query. @ingroup world
b3PlaneResultFcn
Used to collect collision planes for character movers. Return true to continue gathering planes.
b3Pos
In single precision mode these types are the same.
b3PreSolveFcn
Prototype for a pre-solve callback. This is called after a contact is updated. This allows you to inspect a collision before it goes to the solver. Notes:
b3RecQueryType
The kind of a recorded spatial query, matching the public query and cast functions.
b3RestitutionCallback
Optional restitution mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box3D state or user application state. @ingroup world
b3SeparatingFeature
Cached separating axis feature.
b3ShapeType
Shape type @ingroup shape
b3TOIState
Describes the TOI output
b3TaskCallback
Task interface This is the prototype for a Box3D task. Your task system is expected to run this callback on a worker thread, exactly once per enqueue, passing back the same taskContext pointer supplied to b3EnqueueTaskCallback. @ingroup world
b3TreeBoxCastCallbackFcn
This function receives clipped AABB cast input for a proxy. The function returns the new cast fraction.
b3TreeNodeFlags
Flags for tree nodes. For internal usage.
b3TreeQueryCallbackFcn
This function receives proxies found in the AABB query. @return true if the query should continue
b3TreeQueryClosestCallbackFcn
This function receives the minimum distance squared so far and proxy to check in the closest query. @return minimum distance squared to user objects in the proxy
b3TreeRayCastCallbackFcn
This function receives clipped ray cast input for a proxy. The function returns the new ray fraction.
b3TriangleFeature
Cached triangle feature.
b3WorldCastOutput
Same type in single precision.
b3WorldTransform
In single precision mode these types are the same.

Unions§

b3ChildShape__bindgen_ty_1
Tagged union.
b3DebugShape__bindgen_ty_1
Tagged union.
b3MeshNode__bindgen_ty_1
Anonymous union.
b3TreeNode__bindgen_ty_1
b3TreeNode__bindgen_ty_2