Expand description
Height field collision shape.
Port of box3d-cpp-reference/src/height_field.c and the height-field group of
include/box3d/types.h / collision.h.
Layout:
types— HeightFieldDef/Data, edge flags, blob serializationcreate— create/destroy and convexity flagsfactory— grid/wave helpers, dump/loadtriangle— cell corners and triangle accessorscast— AABB, ray cast, shape castquery— overlap, query, mover collide
SPDX-FileCopyrightText: 2026 Erin Catto SPDX-License-Identifier: MIT
Structs§
- Height
Field Data - A height field with compressed storage.
- Height
Field Def - Data used to create a height field. (b3HeightFieldDef)
Constants§
- CONCAVE_
EDGE1 - Triangle mesh edge flags. (b3MeshEdgeFlags)
- CONCAVE_
EDGE2 - CONCAVE_
EDGE3 - HEIGHT_
FIELD_ DATA_ SIZE - Size of the C
b3HeightFieldDataheader (explicit padding, no unnamed gaps). - HEIGHT_
FIELD_ HOLE - This material index designates holes in a height field. (B3_HEIGHT_FIELD_HOLE)
- HEIGHT_
FIELD_ VERSION - 64-bit height-field version. (B3_HEIGHT_FIELD_VERSION)
- INVERSE_
CONCAVE_ EDGE1 - INVERSE_
CONCAVE_ EDGE2 - INVERSE_
CONCAVE_ EDGE3
Functions§
- collide_
mover_ and_ height_ field - Collide a character mover capsule against a height field. (b3CollideMoverAndHeightField)
- compute_
height_ field_ aabb - Compute the AABB of a height field. (b3ComputeHeightFieldAABB)
- convert_
bytes_ to_ height_ field - Restore a height field from a contiguous blob. (inverse of
HeightFieldData::to_bytes) - create_
grid - Create a flat height field grid. (b3CreateGrid)
- create_
height_ field - Create a height field from a definition. (b3CreateHeightField)
- create_
wave - Create a sinusoidal wave height field. (b3CreateWave)
- destroy_
height_ field - Destroy a height field (no-op; Rust drops the owned buffers). (b3DestroyHeightField)
- dump_
height_ data - Dump height field definition to a text file. (b3DumpHeightData)
- get_
height_ field_ compressed_ heights - Compressed height array. (b3GetHeightFieldCompressedHeights)
- get_
height_ field_ flags - Triangle flag array. (b3GetHeightFieldFlags)
- get_
height_ field_ material - Get the material index for a triangle. (b3GetHeightFieldMaterial)
- get_
height_ field_ material_ indices - Material index array. (b3GetHeightFieldMaterialIndices)
- get_
height_ field_ triangle - Get a height field triangle by index. (b3GetHeightFieldTriangle)
- get_
height_ field_ triangle_ count - Triangle count for a height field. (b3GetHeightFieldTriangleCount)
- load_
height_ field - Load a height field from a text file written by
dump_height_data. (b3LoadHeightField) - overlap_
height_ field - Test overlap between a height field and a shape proxy. (b3OverlapHeightField)
- query_
height_ field - Query height field triangles overlapping an AABB.
Callback receives (a, b, c, triangle_index) and may return
falseto stop early. (b3QueryHeightField) - ray_
cast_ height_ field - Ray cast versus a height field in local space. (b3RayCastHeightField)
- shape_
cast_ height_ field - Shape cast versus a height field in local space. (b3ShapeCastHeightField)