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#
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.
Related guides#
- Migrating existing code
- Choosing a Soft Body
- Soft sphere
- Volumetric soft box
- Closed model import
- Cloth model and named anchors
- Separate visual mesh
- Local force and impulse
- Wind
- Carrying Soft Bodies
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 |
|---|---|---|
| JoltBBMODBox.create_attachment | JoltBBMODBox.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_attachment | JoltBBMODCloth.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_attachment | JoltBBMODModel.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_attachment | JoltBBMODSoftBody.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_attachment | JoltBBMODSphere.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.destroy | JoltSoftBodyAttachment.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_body | JoltSoftBodyAttachment.get_body() | Matching live host or undefined (world pins, destroyed host or helper). |
| JoltSoftBodyAttachment.get_point_count | JoltSoftBodyAttachment.get_point_count() | Selected particle count; 0 for an invalid helper. Selection persists while disabled. |
| JoltSoftBodyAttachment.get_position | JoltSoftBodyAttachment.get_position() | World center of selected particles {x, y, z} in m; undefined for an invalid helper. |
| JoltSoftBodyAttachment.is_enabled | JoltSoftBodyAttachment.is_enabled() | Boolean; also false for an invalid helper. |
| JoltSoftBodyAttachment.is_valid | JoltSoftBodyAttachment.is_valid() | Boolean; both helper and its soft body must be live. Destroying the soft body invalidates the helper. |
| JoltSoftBodyAttachment.set_body | JoltSoftBodyAttachment.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_enabled | JoltSoftBodyAttachment.set_enabled(enabled) | Boolean coercion, Boolean result. Disabling releases particles but retains the selection reservation; destroy removes it. Enabling captures current positions. |