Shape Resources
Convex, Mesh and HeightField
Reference and usage: Convex, Mesh and HeightField.
| API | Contract |
|---|---|
| jolt_shape_convex(points, cache_key=undefined) | 4–4096 finite xyz points (arrays or structs); nondegenerate hull with at most 256 hull vertices. Supports moving bodies and generic queries. |
| jolt_shape_mesh(vertices, indices, cache_key=undefined) | 3–65536 vertices and 1–131072 triangles. Flat zero-based integer indices in triples. Static-only. |
| jolt_shape_heightfield(heights, width, height, cell_size, cache_key=undefined, cell_size_y=undefined) | Square grid, integer width = height from 4 to 512. Nested rows or flat y*width+x samples; positive spacing. cell_size_y defaults to cell_size. |
var points = [[-1,-1,0], [1,-1,0], [0,1,0], [0,0,2]];
var hull = jolt_shape_convex(points);
if (is_undefined(hull)) show_debug_message(jolt_get_error_message());
else {
var body = hull.create_dynamic(0, 0, 3);
hull.destroy();
}Verified operation contracts#
These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.
| Symbol / owner | Signature | Operation contract |
|---|---|---|
| jolt_shape_convex | jolt_shape_convex(source_points, cache_key = undefined) | Reusable JoltShape/undefined in managed world: 4..4096 finite local XYZ points, nonzero volume. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only. |
| jolt_shape_heightfield | jolt_shape_heightfield(source_heights, width, height, cell_size, cache_key = undefined, cell_size_y = undefined) | Reusable JoltShape/undefined in managed world: square4..512, flat width*height array or rows, finite heights m, positive cell_size; cell_size_y defaults cell_size. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only. |
| jolt_shape_mesh | jolt_shape_mesh(source_vertices, source_indices, cache_key = undefined) | Reusable JoltShape/undefined in managed world: 3..65536 vertices, 1..131072 triangles; flat index triples, zero-based integer indices in bounds. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only. |