Bodies

Tapered Capsule

Creates a Z-axis capsule with independently sized rounded ends.

Use it for organic collision volumes, handles, limbs, and other convex bodies that narrow from one end to the other. The public origin is centred between the two tips. Dynamic, Static, and Kinematic are supported.

Syntax#

Syntax
jolt_tapered_capsule_create_dynamic(x, y, z, height, top_radius, bottom_radius, options=undefined)
jolt_tapered_capsule_create_static(x, y, z, height, top_radius, bottom_radius, options=undefined)
jolt_tapered_capsule_create_kinematic(x, y, z, height, top_radius, bottom_radius, options=undefined)

Arguments#

ArgumentTypeDescription
x, y, zRealWorld-space centre between the two outer tips.
heightRealFull tip-to-tip local-Z height; must exceed twice the larger radius.
top_radiusRealFinite upper-end radius > 0.
bottom_radiusRealFinite lower-end radius > 0.
optionsStructOptional shared body options.

Geometry and orientation#

The upper sphere centre is at local Z=height/2-top_radius and the lower sphere centre at -height/2+bottom_radius. The wrapper supplies native straight-section half height (height-top_radius-bottom_radius)/2, rotates Jolt's native Y-axis shape to public Z, and recentres its internal centre of mass so the public body origin remains between the tips.

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. Equal radii produce a capsule-like tapered resource, while unequal radii create the tapered profile. Invalid dimensions or options cancel creation atomically.

Reusable JoltShape#

GML
var shape = jolt_shape_tapered_capsule(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);

The reusable resource follows the same validation and lifetime rules as other JoltShape resources. jolt_shape_load() also accepts a valid TaperedCapsule .jcol asset.

Low-Level / Advanced API#

There is no direct ergonomic low-level GML creator. The shape is transported through the versioned resource format and jolt_world_shape_command(); prefer the high-level creator or jolt_shape_tapered_capsule().

Example#

GML
var body = jolt_tapered_capsule_create_dynamic(-2, 0, 6, 4, 0.35, 0.8, {
    mass: 2,
    angular_velocity: {x:0.3, y:0.5, z:0.2}
});

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_tapered_capsule_create_dynamicjolt_tapered_capsule_create_dynamic(x = 0, y = 0, z = 0, height = 2, top_radius = 0.25, bottom_radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. total height >2*max(top, bottom radius), positive radii m. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.
jolt_tapered_capsule_create_kinematicjolt_tapered_capsule_create_kinematic(x = 0, y = 0, z = 0, height = 2, top_radius = 0.25, bottom_radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. total height >2*max(top, bottom radius), positive radii m. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.
jolt_tapered_capsule_create_staticjolt_tapered_capsule_create_static(x = 0, y = 0, z = 0, height = 2, top_radius = 0.25, bottom_radius = 0.5, options = undefined)Factory for the named motion type, XYZ position defaults 0m plus options. total height >2*max(top, bottom radius), positive radii m. Returns JoltBody/undefined; options failure cleans up the new body. Finite dimensions; set_ changes preserve identity.