‹›
Shape Resources

Creating Bodies from Shapes

Body options use the same managed options as ordinary body constructors: rotation, velocity, mass/material settings, layer, sensor and center_of_mass_offset where supported. Shape metadata is shared; transform and body state are independent for every body.

APIContract
shape.create_dynamic(x, y, z, options=undefined)Creates a Dynamic JoltBody; returns undefined on failure.
shape.create_static(x, y, z, options=undefined)Creates a Static body, including Mesh, HeightField and Plane.
shape.create_kinematic(x, y, z, options=undefined)Creates a target-driven Kinematic body; static-only shapes are rejected.
GML
var shape = jolt_shape_sphere(0.5);
if (!is_undefined(shape)) {
    var ball = shape.create_dynamic(0, 0, 5, {mass: 2, friction: 0.6});
    if (is_undefined(ball)) show_debug_message(jolt_get_error_message());
    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
JoltShape.create_dynamicJoltShape.create_dynamic(x = 0, y = 0, z = 0, options = undefined)Creates a new JoltBody/undefined, XYZ defaults 0, standard Body options. Mesh/Heightfield/Plane Static only; resource remains reusable. _create is an implementation delegate with explicit motion; applications should use create_* variants.
JoltShape.create_kinematicJoltShape.create_kinematic(x = 0, y = 0, z = 0, options = undefined)Creates a new JoltBody/undefined, XYZ defaults 0, standard Body options. Mesh/Heightfield/Plane Static only; resource remains reusable. _create is an implementation delegate with explicit motion; applications should use create_* variants.
JoltShape.create_staticJoltShape.create_static(x = 0, y = 0, z = 0, options = undefined)Creates a new JoltBody/undefined, XYZ defaults 0, standard Body options. Mesh/Heightfield/Plane Static only; resource remains reusable. _create is an implementation delegate with explicit motion; applications should use create_* variants.