Skip to main content

Module height_field

Module height_field 

Source
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 serialization
  • create — create/destroy and convexity flags
  • factory — grid/wave helpers, dump/load
  • triangle — cell corners and triangle accessors
  • cast — AABB, ray cast, shape cast
  • query — overlap, query, mover collide

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

Structs§

HeightFieldData
A height field with compressed storage.
HeightFieldDef
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 b3HeightFieldData header (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 false to 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)