Expand description
Collision shapes attached to bodies (sphere, capsule, hull, mesh, …).
Create shapes with create_sphere_shape, create_capsule_shape,
create_hull_shape, and the mesh/height-field/compound helpers, using a
crate::types::ShapeDef from crate::types::default_shape_def. Geometry
primitives live in crate::geometry and crate::hull.
Port of shape.h / shape.c. This file holds the data model and filter
predicates; create/destroy and mutators are re-exported from submodules.
SPDX-FileCopyrightText: 2025 Erin Catto SPDX-License-Identifier: MIT
Modules§
- shape_
flags - Shape flag bits. (enum b3ShapeFlags)
Structs§
- Shape
- Internal shape. (b3Shape)
Enums§
- Shape
Geometry - Concrete shape geometry. Maps to C’s
typetag + anonymous union.
Functions§
- collide_
mover - Collide a capsule mover with a shape, writing contact planes into
planes. Transforms the mover into local space, dispatches, then rotates results back. (b3CollideMover) - compute_
fat_ shape_ aabb - (b3ComputeFatShapeAABB)
- compute_
shape_ aabb - (b3ComputeShapeAABB)
- compute_
shape_ extent - (b3ComputeShapeExtent)
- compute_
shape_ mass - (b3ComputeShapeMass)
- compute_
swept_ shape_ aabb - Swept AABB of a convex shape along a sweep at time in [0, 1]. (b3ComputeSweptShapeAABB)
- create_
capsule_ shape - (b3CreateCapsuleShape)
- create_
compound_ shape - (b3CreateCompoundShape)
- create_
height_ field_ shape - (b3CreateHeightFieldShape)
- create_
hull_ shape - (b3CreateHullShape)
- create_
mesh_ shape - (b3CreateMeshShape)
- create_
shape_ proxy - (b3CreateShapeProxy)
- create_
sphere_ shape - (b3CreateSphereShape)
- destroy_
shape - Destroy a shape. (b3DestroyShape)
- destroy_
shape_ proxy - (b3DestroyShapeProxy)
- get_
shape - Resolve a ShapeId to the shape index. (b3GetShape)
- get_
shape_ centroid - (b3GetShapeCentroid)
- get_
shape_ projected_ area - Projected area of a shape onto a plane with the given normal. Used by explosions. (b3GetShapeProjectedArea)
- make_
shape_ proxy - Convex shape proxy for distance / TOI. Mesh, height, and compound need their own query paths. (b3MakeShapeProxy)
- mesh_
geometry - Convenience: unit-scale mesh geometry. (b3Mesh with identity scale)
- overlap_
shape - Test overlap between a shape and a shape proxy. (b3OverlapShape)
- ray_
cast_ shape - Ray cast a shape in world (or relative) space. Transforms the ray into local space, dispatches, then transforms the hit back. (b3RayCastShape)
- shape_
apply_ wind - Apply a wind force to the body for this shape using the density of air. (b3Shape_ApplyWind)
- shape_
are_ contact_ events_ enabled - (b3Shape_AreContactEventsEnabled)
- shape_
are_ hit_ events_ enabled - (b3Shape_AreHitEventsEnabled)
- shape_
are_ pre_ solve_ events_ enabled - (b3Shape_ArePreSolveEventsEnabled)
- shape_
are_ sensor_ events_ enabled - (b3Shape_AreSensorEventsEnabled)
- shape_
cast_ shape - Shape cast a shape in world (or relative) space. (b3ShapeCastShape)
- shape_
compute_ mass_ data - Compute the mass data for a shape. (b3Shape_ComputeMassData)
- shape_
enable_ contact_ events - (b3Shape_EnableContactEvents)
- shape_
enable_ hit_ events - (b3Shape_EnableHitEvents)
- shape_
enable_ pre_ solve_ events - (b3Shape_EnablePreSolveEvents)
- shape_
enable_ sensor_ events - (b3Shape_EnableSensorEvents)
- shape_
get_ aabb - (b3Shape_GetAABB)
- shape_
get_ body - (b3Shape_GetBody)
- shape_
get_ capsule - (b3Shape_GetCapsule)
- shape_
get_ closest_ point - Closest point on a shape to a target in the query frame. (b3Shape_GetClosestPoint)
- shape_
get_ contact_ capacity - Conservative contact capacity for a non-sensor shape. (b3Shape_GetContactCapacity)
- shape_
get_ contact_ data - Touching contact data involving this shape. (b3Shape_GetContactData)
- shape_
get_ density - (b3Shape_GetDensity)
- shape_
get_ filter - (b3Shape_GetFilter)
- shape_
get_ friction - (b3Shape_GetFriction)
- shape_
get_ hull - (b3Shape_GetHull) — returns None for non-hull shapes.
- shape_
get_ mesh_ material_ count - (b3Shape_GetMeshMaterialCount)
- shape_
get_ mesh_ surface_ material - (b3Shape_GetMeshSurfaceMaterial)
- shape_
get_ name - (b3Shape_GetName)
- shape_
get_ restitution - (b3Shape_GetRestitution)
- shape_
get_ sensor_ capacity - Capacity required for
shape_get_sensor_data/ sensor overlaps. Returns 0 if the shape is not a sensor. (b3Shape_GetSensorCapacity) - shape_
get_ sensor_ data - Overlapped shapes for a sensor. Overlaps may contain destroyed shapes —
use
super::shape_is_validto confirm each. (b3Shape_GetSensorData; docs also call this GetSensorOverlaps) - shape_
get_ sensor_ overlaps - Alias for
shape_get_sensor_datamatching the header doc nameb3Shape_GetSensorOverlaps. - shape_
get_ sphere - (b3Shape_GetSphere)
- shape_
get_ surface_ material - (b3Shape_GetSurfaceMaterial)
- shape_
get_ type - (b3Shape_GetType)
- shape_
get_ user_ data - (b3Shape_GetUserData)
- shape_
get_ world - (b3Shape_GetWorld)
- shape_
is_ sensor - (b3Shape_IsSensor)
- shape_
is_ valid - Shape identifier validation. (b3Shape_IsValid)
- shape_
ray_ cast - World-space ray cast against a single shape. (b3Shape_RayCast)
- shape_
set_ capsule - (b3Shape_SetCapsule)
- shape_
set_ density - (b3Shape_SetDensity)
- shape_
set_ filter - (b3Shape_SetFilter)
- shape_
set_ friction - (b3Shape_SetFriction)
- shape_
set_ hull - (b3Shape_SetHull)
- shape_
set_ mesh - (b3Shape_SetMesh)
- shape_
set_ mesh_ material - (b3Shape_SetMeshMaterial)
- shape_
set_ name - Set the shape name (truncated to
SHAPE_NAME_LENGTH). Uses the world name cache rather than C’s fixed char buffer. (b3Shape_SetName) - shape_
set_ restitution - (b3Shape_SetRestitution)
- shape_
set_ sphere - (b3Shape_SetSphere)
- shape_
set_ surface_ material - (b3Shape_SetSurfaceMaterial)
- shape_
set_ user_ data - (b3Shape_SetUserData) — Rust stores
u64instead ofvoid*. - shape_
time_ of_ impact - Time of impact between two shapes along sweeps. Convex vs convex uses GJK TOI; mesh/height/compound use triangle/child queries. (b3ShapeTimeOfImpact)
- should_
query_ collide - (static inline b3ShouldQueryCollide)
- should_
shapes_ collide - (static inline b3ShouldShapesCollide)