‹›
Current project

Spatial attachments

Coordinates select particles on the current world-space shape, not a target destination. Radius zero selects the nearest particle; positive radius selects all inside a sphere. Empty or overlapping regions fail. Disabled attachments still reserve their particles until destroyed. Changing host or enabling captures current offsets without a jump.

Example#

GML
anchor = soft.create_attachment(0, 0, 3.5, 0.3);
if (!is_undefined(anchor)) {
    anchor.set_body(support);
    // anchor.set_enabled(false);
    // anchor.destroy();
}

Usage and limits#

World/Static/Kinematic targets prescribe positions. Dynamic hosts use compliant two-way attachments with opposite impulses and host rotation. This is not a rigid weld. Only the Soft Body–host collision pair is suppressed; other collisions remain. Dynamic attachments subdivide the world step to at most 1/480 s, capped at roughly 64 segments; measure scene-wide cost.

A destroyed host disables its attachments but preserves selections for reassignment. Soft Body destruction removes them. Existing cloth grid pins retain their original one-way behavior and cannot overwrite particles reserved by spatial attachments. Release the region through the attachment itself. Getters report current position, point count, host and enabled state.

API reference#

Public function and method signatures. Call methods on the returned instance; parameters with defaults are optional.

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
JoltBBMODBox.create_attachmentJoltBBMODBox.create_attachment(x,y,z,radius=0)World x/y/z and nonnegative radius, finite with absolute values ≤ 1e9. radius=0 selects the nearest particle in the current deformation, >0 a sphere. Returns JoltSoftBodyAttachment or undefined; empty/overlapping selections are rejected even against disabled attachments. Newly selected particles are pinned to the world.
JoltBBMODCloth.create_attachmentJoltBBMODCloth.create_attachment(x,y,z,radius=0)World x/y/z and nonnegative radius, finite with absolute values ≤ 1e9. radius=0 selects the nearest particle in the current deformation, >0 a sphere. Returns JoltSoftBodyAttachment or undefined; empty/overlapping selections are rejected even against disabled attachments. Newly selected particles are pinned to the world.
JoltBBMODModel.create_attachmentJoltBBMODModel.create_attachment(x,y,z,radius=0)World x/y/z and nonnegative radius, finite with absolute values ≤ 1e9. radius=0 selects the nearest particle in the current deformation, >0 a sphere. Returns JoltSoftBodyAttachment or undefined; empty/overlapping selections are rejected even against disabled attachments. Newly selected particles are pinned to the world.
JoltBBMODSoftBody.create_attachmentJoltBBMODSoftBody.create_attachment(x,y,z,radius=0)World x/y/z and nonnegative radius, finite with absolute values ≤ 1e9. radius=0 selects the nearest particle in the current deformation, >0 a sphere. Returns JoltSoftBodyAttachment or undefined; empty/overlapping selections are rejected even against disabled attachments. Newly selected particles are pinned to the world.
JoltBBMODSphere.create_attachmentJoltBBMODSphere.create_attachment(x,y,z,radius=0)World x/y/z and nonnegative radius, finite with absolute values ≤ 1e9. radius=0 selects the nearest particle in the current deformation, >0 a sphere. Returns JoltSoftBodyAttachment or undefined; empty/overlapping selections are rejected even against disabled attachments. Newly selected particles are pinned to the world.
JoltSoftBodyAttachment.destroyJoltSoftBodyAttachment.destroy()Boolean, repeated destruction is safe. Removes only the helper, not the soft body or rigid host. Wind disables airflow, Force cancels the pending request, Attachment releases its particle selection.
JoltSoftBodyAttachment.get_bodyJoltSoftBodyAttachment.get_body()Matching live host or undefined (world pins, destroyed host or helper).
JoltSoftBodyAttachment.get_point_countJoltSoftBodyAttachment.get_point_count()Selected particle count; 0 for an invalid helper. Selection persists while disabled.
JoltSoftBodyAttachment.get_positionJoltSoftBodyAttachment.get_position()World center of selected particles {x, y, z} in m; undefined for an invalid helper.
JoltSoftBodyAttachment.is_enabledJoltSoftBodyAttachment.is_enabled()Boolean; also false for an invalid helper.
JoltSoftBodyAttachment.is_validJoltSoftBodyAttachment.is_valid()Boolean; both helper and its soft body must be live. Destroying the soft body invalidates the helper.
JoltSoftBodyAttachment.set_bodyJoltSoftBodyAttachment.set_body(body=undefined)Live JoltBody in the same world or undefined for world pins; Boolean. Captures current relative positions. A Dynamic host uses dynamic anchors, not infinitely heavy world pins.
JoltSoftBodyAttachment.set_enabledJoltSoftBodyAttachment.set_enabled(enabled)Boolean coercion, Boolean result. Disabling releases particles but retains the selection reservation; destroy removes it. Enabling captures current positions.