Tapered Cylinder
Creates a Z-axis cylinder or frustum with independent top and bottom radii.
Use it for cones, truncated cones, tapered pillars, wheels, and other convex solids with circular ends. The body origin is at the middle of the full height. Dynamic, Static, and Kinematic are supported.
Syntax#
jolt_tapered_cylinder_create_dynamic(x, y, z, height, top_radius, bottom_radius, options=undefined)
jolt_tapered_cylinder_create_static(x, y, z, height, top_radius, bottom_radius, options=undefined)
jolt_tapered_cylinder_create_kinematic(x, y, z, height, top_radius, bottom_radius, options=undefined)Arguments#
| Argument | Type | Description |
|---|---|---|
| x, y, z | Real | World-space centre/pivot. |
| height | Real | Finite full local-Z height > 0. |
| top_radius | Real | Finite upper radius >= 0. |
| bottom_radius | Real | Finite lower radius >= 0. |
| options | Struct | Optional shared body options. |
Geometry and orientation#
The lower face lies at local Z=-height/2 and the upper face at +height/2. The wrapper supplies half_height=height/2 and rotates Jolt's native Y-axis TaperedCylinder to public Z before applying the body rotation.
Return and behaviour#
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 height, radii, positions, or options cancel creation atomically.
Reusable JoltShape#
var shape = jolt_shape_tapered_cylinder(height, top_radius, bottom_radius, cache_key=undefined);
var body = shape.create_dynamic(x, y, z, options);
var static_body = shape.create_static(x, y, z, options);
var kinematic_body = shape.create_kinematic(x, y, z, options);jolt_shape_load() also accepts a valid TaperedCylinder .jcol asset.
Low-Level / Advanced API#
There is no direct ergonomic low-level GML creator. Prefer the high-level functions or the reusable shape resource.
Example#
// A cone pointing toward local +Z.
var cone = jolt_tapered_cylinder_create_dynamic(2, 0, 5, 3, 0, 0.85, {
mass: 2,
friction: 0.6
});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_tapered_cylinder_create_dynamic | jolt_tapered_cylinder_create_dynamic(x = 0, y = 0, z = 0, height = 1, top_radius = 0.25, bottom_radius = 0.5, options = undefined) | Factory for the named motion type, XYZ position defaults 0m plus options. height>0 m, radii>=0, at least one>0. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity. |
| jolt_tapered_cylinder_create_kinematic | jolt_tapered_cylinder_create_kinematic(x = 0, y = 0, z = 0, height = 1, top_radius = 0.25, bottom_radius = 0.5, options = undefined) | Factory for the named motion type, XYZ position defaults 0m plus options. height>0 m, radii>=0, at least one>0. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity. |
| jolt_tapered_cylinder_create_static | jolt_tapered_cylinder_create_static(x = 0, y = 0, z = 0, height = 1, top_radius = 0.25, bottom_radius = 0.5, options = undefined) | Factory for the named motion type, XYZ position defaults 0m plus options. height>0 m, radii>=0, at least one>0. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity. |