Skip to main content

Module compound

Module compound 

Source
Expand description

Baked compound collision shape.

Port of box3d-cpp-reference/src/compound.c and the compound group of include/box3d/types.h / collision.h.

Layout:

  • types — CompoundDef/Data, child accessors, SurfaceMaterial consumers
  • create — create/destroy with material/hull/mesh sharing
  • serialize — convert to/from contiguous bytes
  • cast — AABB, overlap, ray cast, shape cast
  • query — AABB query, collide mover

Deferred: world shape attach. Compound CCD TOI lives in shape::toi (matching the live path in C shape.c; compound.c’s copy is #if 0).

SPDX-FileCopyrightText: 2025 Erin Catto SPDX-License-Identifier: MIT

Structs§

ChildShape
Child shape of a compound. (b3ChildShape)
CompoundCapsule
A capsule that lives in a compound. (b3CompoundCapsule)
CompoundCapsuleDef
Definition for a capsule in a compound shape. (b3CompoundCapsuleDef)
CompoundData
The runtime data for a baked compound shape. (b3CompoundData)
CompoundDef
Definition for creating a compound shape. (b3CompoundDef)
CompoundHull
A hull that lives in a compound. (b3CompoundHull)
CompoundHullDef
Definition for a convex hull in a compound shape. (b3CompoundHullDef)
CompoundMesh
A mesh with non-uniform scale that lives in a compound. (b3CompoundMesh)
CompoundMeshDef
Definition for a triangle mesh in a compound shape. (b3CompoundMeshDef)
CompoundSphere
A sphere that lives in a compound. (b3CompoundSphere)
CompoundSphereDef
Definition for a sphere in a compound shape. (b3CompoundSphereDef)

Enums§

ChildGeometry
Child geometry of a compound. (union half of b3ChildShape)

Constants§

COMPOUND_VERSION
The compound version depends on the tree, mesh, and hull versions. (B3_COMPOUND_VERSION)
MAX_COMPOUND_MESH_MATERIALS
Meshes used in compounds have limited space for materials. (B3_MAX_COMPOUND_MESH_MATERIALS)

Functions§

collide_mover_and_compound
Collide a capsule mover against a compound. (b3CollideMoverAndCompound)
compute_compound_aabb
Compute the AABB of a compound. (b3ComputeCompoundAABB)
convert_bytes_to_compound
Restore a compound from a byte buffer. (b3ConvertBytesToCompound)
convert_compound_to_bytes
Scrub and return the compound as a byte buffer. (b3ConvertCompoundToBytes)
create_compound
Create a baked compound shape. (b3CreateCompound)
destroy_compound
Destroy a compound shape. (b3DestroyCompound)
get_compound_capsule
Capsule at index. (b3GetCompoundCapsule)
get_compound_child
Child shape by flat index (capsules → hulls → meshes → spheres). (b3GetCompoundChild)
get_compound_hull
Hull at index. (b3GetCompoundHull)
get_compound_materials
Compound materials. (b3GetCompoundMaterials)
get_compound_mesh
Mesh at index. (b3GetCompoundMesh)
get_compound_sphere
Sphere at index. (b3GetCompoundSphere)
make_compound_child_sweep
Static compound-child sweep for TOI (child fixed in compound frame). xf = compoundTransform * childTransform. (b3MakeCompoundChildSweep)
overlap_compound
Test overlap between a compound and a shape proxy. (b3OverlapCompound)
query_compound
Query an AABB against compound children. (b3QueryCompound)
ray_cast_compound
Ray cast versus a compound. (b3RayCastCompound)
shape_cast_compound
Shape cast versus a compound. (b3ShapeCastCompound)