Cloth model and named anchors
Use one connected open triangulated surface, possibly with holes, without skinning. Import before model.freeze(). Limits are 4096 welded particles and 8192 triangles; a perfectly flat model is allowed. Unlike a closed shell, cloth rejects nonzero pressure and returns zero volume.
Example#
cloth = jolt_soft_body_create_cloth_from_model(model_flag, 0, 0, 3);
if (!is_undefined(cloth)) {
cloth.set_mass(2);
cloth.set_stretch(0.1);
cloth.set_bend(0);
cloth.set_renderer(o_control_bbmod_renderer.renderer);
anchor = cloth.create_attachment_from_node("anchor_top", 0.25);
}Usage and limits#
stretch/bend range 0..1, higher is stiffer. Bend zero removes bending constraints. Runtime changes preserve particles, attachments and Carry. A named attachment uses an exact unique case-sensitive BBMOD node name, such as a Blender Empty. Radius zero selects the nearest original-model vertex; positive radius selects an area. It pins current deformed positions rather than resetting to rest.
The Empty display size does not set radius. Missing/duplicate names, empty selections or overlap return undefined. No new addon JSON is required. Named anchors also work on closed imported models, using nodes captured from the physics source, not replacement visual nodes. set_body attaches without moving the cloth to the host.
API reference#
Public function and method signatures. Call methods on the returned instance; parameters with defaults are optional.
| Function / method | Signature |
|---|---|
| jolt_soft_body_create_cloth_from_model | jolt_soft_body_create_cloth_from_model(model,x=0,y=0,z=0,settings=undefined) |
| JoltBBMODModel.create_attachment_from_node | JoltBBMODModel.create_attachment_from_node(name,radius=0) |
| JoltBBMODModel.get_bend | JoltBBMODModel.get_bend() |
| JoltBBMODModel.get_stretch | JoltBBMODModel.get_stretch() |
| JoltBBMODModel.set_bend | JoltBBMODModel.set_bend(v) |
| JoltBBMODModel.set_stretch | JoltBBMODModel.set_stretch(v) |
Related guides#
- Migrating existing code
- Choosing a Soft Body
- Soft sphere
- Volumetric soft box
- Closed model import
- Spatial attachments
- 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 |
|---|---|---|
| jolt_soft_body_create_cloth_from_model | jolt_soft_body_create_cloth_from_model(model,x=0,y=0,z=0,settings=undefined) | Creates a open model cloth as JoltBBMODModel or returns undefined. Loaded static BBMOD_Model before freeze(), no bones, triangle-list, at most 4096 welded vertices/8192 triangles. Node transforms and options scale (default 1, magnitude 1e-5..10000), rotation_x/y/z (0°) are baked once. Position is world-space, default 0. Does not take ownership of the model or its materials. Closed: mass=2, stiffness=.8, pressure=50, damping=.2; cloth: mass=1, stretch=.9, bend=.3, pressure=0, damping=.1. Shared friction=.5, gravity_factor=1, thickness=.01 (fitted to the shortest edge when omitted), default layer. |
| JoltBBMODModel.create_attachment_from_node | JoltBBMODModel.create_attachment_from_node(name,radius=0) | Nonempty unique node name, radius 0..10000 m, default 0. Selects particles in the original model (0 = nearest), pins their current world positions. Returns Attachment/undefined; rejects missing/ambiguous nodes, empty selection or overlap with a pin/attachment. |
| JoltBBMODModel.get_bend | JoltBBMODModel.get_bend() | Stiffness 0..1, undefined for an invalid wrapper; inspect native errors separately. Available only for procedural or open model cloth. |
| JoltBBMODModel.get_stretch | JoltBBMODModel.get_stretch() | Stretch stiffness: current numeric value in dimensionless units. Failure: undefined; an invalid object is not a zero measurement. |
| JoltBBMODModel.set_bend | JoltBBMODModel.set_bend(v) | Procedural or open model cloth only: finite stiffness 0..1, default 0.3. Boolean; 0 removes bend constraints, positive values rebuild them from rest geometry without changing particle/attachment identities. A closed model has no such method. |
| JoltBBMODModel.set_stretch | JoltBBMODModel.set_stretch(v) | Stretch stiffness: finite number 0..1 ; default 0.8 Sphere/closed model, 0.3 Box, 0.9 model cloth. Returns true on acceptance, false for an invalid input or object. Updates the live object. |