‹›
Shape Resources

Primitive Resources

Dimensions must be finite. These are managed full-dimension conventions; do not copy low-level half-extents directly into these constructors.

APIContract
jolt_shape_box(width, depth, height, cache_key=undefined)Positive full dimensions.
jolt_shape_sphere(radius, cache_key=undefined)Positive radius.
jolt_shape_capsule(height, radius, cache_key=undefined)Total height > 2 × radius; radius positive.
jolt_shape_cylinder(height, radius, cache_key=undefined)Positive total height and radius.
jolt_shape_tapered_capsule(height, top_radius, bottom_radius, cache_key=undefined)Both radii positive; total height > 2 × the larger radius.
jolt_shape_tapered_cylinder(height, top_radius, bottom_radius, cache_key=undefined)Positive height, nonnegative radii with at least one positive.
jolt_shape_plane(nx, ny, nz, half_extent=1000, cache_key=undefined)Nonzero normal; static-only infinite plane/negative half-space. half_extent controls bounds, not a finite collision edge.
GML
var capsule_shape = jolt_shape_capsule(1.8, 0.4);
if (is_undefined(capsule_shape)) {
    show_debug_message(jolt_get_error_message());
} else {
    var body = capsule_shape.create_dynamic(0, 0, 3);
    capsule_shape.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 / ownerSignatureOperation contract
jolt_shape_boxjolt_shape_box(width, depth, height, cache_key = undefined)Reusable JoltShape/undefined in managed world: positive full width/depth/height in m. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_capsulejolt_shape_capsule(height, radius, cache_key = undefined)Reusable JoltShape/undefined in managed world: total height>2*radius, radius>0m. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_cylinderjolt_shape_cylinder(height, radius, cache_key = undefined)Reusable JoltShape/undefined in managed world: height/radius>0m. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_planejolt_shape_plane(normal_x, normal_y, normal_z, half_extent = 1000, cache_key = undefined)Reusable JoltShape/undefined in managed world: nonzero normal normalized, half_extent>0m default 1000. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_spherejolt_shape_sphere(radius, cache_key = undefined)Reusable JoltShape/undefined in managed world: positive radius in m. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_tapered_capsulejolt_shape_tapered_capsule(height, top_radius, bottom_radius, cache_key = undefined)Reusable JoltShape/undefined in managed world: height>2*largest radius, both radii>0. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.
jolt_shape_tapered_cylinderjolt_shape_tapered_cylinder(height, top_radius, bottom_radius, cache_key = undefined)Reusable JoltShape/undefined in managed world: height>0, radii>=0 and at least one>0. Optional cache_key is identity, not a geometry hash; an existing key can return earlier geometry. Mesh/Heightfield/Plane are Static only.