Bodies

Cylinder

Creates a solid cylinder whose public default axis is Z.

x, y, and z are the centre; the base is at local Z=-height/2 and the top at Z=+height/2. Dynamic, Static, and Kinematic are supported.

Syntax#

Syntax
jolt_cylinder_create_dynamic(x, y, z, height, radius, options=undefined)
jolt_cylinder_create_static(x, y, z, height, radius, options=undefined)
jolt_cylinder_create_kinematic(x, y, z, height, radius, options=undefined)

Arguments#

ArgumentTypeDescription
x, y, zRealWorld-space centre/pivot.
heightRealFinite full local-Z height > 0.
radiusRealFinite local-XY radius > 0.
optionsStructShared options struct.

The wrapper supplies half_height=height/2. Native Cylinder uses local Y and is rotated +90° around X to public Z.

Return and validation#

Returns a JoltBody or undefined. It supports the standard JoltBody properties, collision layers, sensor mode, contacts, and raycasts; motion-type restrictions still apply to forces, mass, and velocity. Invalid positions, dimensions, or options cancel creation. Debug draw uses full height and radius.

Reusable JoltShape#

GML
var shape = jolt_shape_cylinder(height, radius, cache_key=undefined);
shape.create_dynamic(x, y, z, options);
shape.create_static(x, y, z, options);
shape.create_kinematic(x, y, z, options);

Example#

GML
var barrel = jolt_cylinder_create_dynamic(0, 3, 4, 1.6, 0.55, {
    mass:3, friction:0.6,
    rotation_euler:{x:0, y:90, z:0}
});

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_cylinder_create_dynamicjolt_cylinder_create_dynamic(x = 0, y = 0, z = 0, height = 1, radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. full height and radius >0 m, defaults 1/.5. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.
jolt_cylinder_create_kinematicjolt_cylinder_create_kinematic(x = 0, y = 0, z = 0, height = 1, radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. full height and radius >0 m, defaults 1/.5. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.
jolt_cylinder_create_staticjolt_cylinder_create_static(x = 0, y = 0, z = 0, height = 1, radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. full height and radius >0 m, defaults 1/.5. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.