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#
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#
| Argument | Type | Description |
|---|---|---|
| x, y, z | Real | World-space centre/pivot. |
| height | Real | Finite full local-Z height > 0. |
| radius | Real | Finite local-XY radius > 0. |
| options | Struct | Shared 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#
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#
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 / owner | Signature | Operation contract |
|---|---|---|
| jolt_cylinder_create_dynamic | jolt_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_kinematic | jolt_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_static | jolt_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. |