‹›
Cloth

Pinning and Attachments

Pin material points in space or attach them to a moving rigid body.

Pin material points in space or attach them to a moving rigid body.

GML
cloth.pin_edge("top");
cloth.unpin_edge("top");
cloth.pin_corner("top_left");
cloth.pin_point(0, 0);
var pinned = cloth.is_point_pinned(0, 0);
cloth.unpin_point(0, 0);
// Moving rigid-body anchor:
cloth.attach_edge("top", support_body);
cloth.detach_edge("top");

A pinned particle has zero inverse mass and remains at its current world position. Pinning does not reset the original rest pose. Edges: top, bottom, left, right; corners: top_left, top_right, bottom_left, bottom_right. Top is grid y=0.

For a body attachment use attach_point/attach_edge or a spatial create_attachment() group. Static and kinematic supports prescribe motion; dynamic supports use compliant two-way coupling. Existing attachment ownership rules prevent conflicting pins. Imported BBMOD cloth can also use create_attachment_from_node(name, radius).

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
JoltBBMODCloth.is_point_pinnedJoltBBMODCloth.is_point_pinned(x,y)Boolean for an integer grid point including boundaries; also false for an invalid point/wrapper. Attached and pinned are not interchangeable queries: moving host versus particle fixation.
JoltBBMODCloth.pin_cornerJoltBBMODCloth.pin_corner(name)pin_corner: names top_left, top_right, bottom_left, bottom_right, case-insensitive. Boolean; labels follow the original grid, not world directions after rotation. top is y=0. attach_edge requires a live JoltBody in the same world.
JoltBBMODCloth.pin_edgeJoltBBMODCloth.pin_edge(name)pin_edge: names top, bottom, left, right, case-insensitive. Boolean; labels follow the original grid, not world directions after rotation. top is y=0. attach_edge requires a live JoltBody in the same world.
JoltBBMODCloth.pin_pointJoltBBMODCloth.pin_point(x,y)Pins a point to the world. Integer grid x=0..segments_x, y=0..segments_y including boundaries. Boolean; these are not world coordinates.
JoltBBMODCloth.unpin_cornerJoltBBMODCloth.unpin_corner(name)unpin_corner: names top_left, top_right, bottom_left, bottom_right, case-insensitive. Boolean; labels follow the original grid, not world directions after rotation. top is y=0. attach_edge requires a live JoltBody in the same world.
JoltBBMODCloth.unpin_edgeJoltBBMODCloth.unpin_edge(name)unpin_edge: names top, bottom, left, right, case-insensitive. Boolean; labels follow the original grid, not world directions after rotation. top is y=0. attach_edge requires a live JoltBody in the same world.
JoltBBMODCloth.unpin_pointJoltBBMODCloth.unpin_point(x,y)Unpins a point. Integer grid x=0..segments_x, y=0..segments_y including boundaries. Boolean; these are not world coordinates.