Expand description
Shape geometry queries: sphere, capsule, and hull mass/AABB/overlap/cast.
Port of box3d-cpp-reference/src/sphere.c, capsule.c, and the query APIs
at the end of hull.c. Types come from include/box3d/types.h.
Layout (mirrors box2d-rust geometry/):
types.rs— MassData, Sphere, Capsule, RayCastInput, ShapeCastInputsphere.rs— sphere mass, AABB, overlap, ray/shape castcapsule.rs— capsule mass, AABB, overlap, ray/shape cast
Hull queries live in [crate::hull::queries] and are re-exported here.
SPDX-FileCopyrightText: 2026 Erin Catto SPDX-License-Identifier: MIT
Re-exports§
pub use crate::distance::CastOutput;pub use crate::hull::collide_mover_and_hull;pub use crate::hull::compute_hull_aabb;pub use crate::hull::compute_hull_mass;pub use crate::hull::compute_swept_hull_aabb;pub use crate::hull::overlap_hull;pub use crate::hull::ray_cast_hull;pub use crate::hull::shape_cast_hull;
Structs§
- Capsule
- A solid capsule can be viewed as two hemispheres connected by a cylinder. (b3Capsule)
- Collision
Plane - Collision planes that can be fed to
crate::mover::solve_planes. Normally assembled by the user fromPlaneResultvalues. (b3CollisionPlane) - Mass
Data - This holds the mass data computed for a shape. (b3MassData)
- Plane
Result - The plane between a character mover and a shape. (b3PlaneResult)
- Plane
Solver Result - Result returned by
crate::mover::solve_planes. (b3PlaneSolverResult) - RayCast
Input - Low level ray cast input data. (b3RayCastInput)
- Shape
Cast Input - Low level shape cast input in generic form. This allows casting an arbitrary point cloud wrapped 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 eight points with a zero radius. (b3ShapeCastInput)
- Shape
Extent - Minimum and maximum extent of a shape relative to a local origin. (math_internal.h: b3ShapeExtent)
- Sphere
- A solid sphere. (b3Sphere)
- Surface
Material - Material properties supported per triangle on meshes and height fields. (b3SurfaceMaterial)
Enums§
- Shape
Type - Shape type. (b3ShapeType)
Constants§
- SURFACE_
MATERIAL_ SIZE - Size of C
b3SurfaceMaterialincluding trailing padding to 8-byte alignment.
Functions§
- collide_
mover_ and_ capsule - Collide a capsule mover against a capsule. (b3CollideMoverAndCapsule)
- collide_
mover_ and_ sphere - Collide a capsule mover against a sphere. (b3CollideMoverAndSphere)
- compute_
capsule_ aabb - Compute the AABB of a capsule. (b3ComputeCapsuleAABB)
- compute_
capsule_ mass - Compute mass properties of a capsule. (b3ComputeCapsuleMass)
- compute_
sphere_ aabb - Compute the AABB of a sphere. (b3ComputeSphereAABB)
- compute_
sphere_ mass - Compute mass properties of a sphere. (b3ComputeSphereMass)
- compute_
swept_ capsule_ aabb - Compute the swept AABB of a capsule between two transforms. (b3ComputeSweptCapsuleAABB)
- compute_
swept_ sphere_ aabb - Compute the swept AABB of a sphere between two transforms. (b3ComputeSweptSphereAABB)
- default_
surface_ material - Use this to initialize your surface material. (b3DefaultSurfaceMaterial)
- is_
valid_ ray - Validate ray cast input data (NaN, etc). (b3IsValidRay)
- overlap_
capsule - Test overlap between a capsule and a shape proxy. (b3OverlapCapsule)
- overlap_
sphere - Test overlap between a sphere and a shape proxy. (b3OverlapSphere)
- ray_
cast_ capsule - Ray cast versus capsule shape in local space. (b3RayCastCapsule)
- ray_
cast_ hollow_ sphere - Ray cast versus a hollow sphere (interior hits allowed). (b3RayCastHollowSphere)
- ray_
cast_ sphere - Ray cast versus sphere shape in local space. (b3RayCastSphere)
- shape_
cast_ capsule - Shape cast versus a capsule. (b3ShapeCastCapsule)
- shape_
cast_ sphere - Shape cast versus a sphere. (b3ShapeCastSphere)