Chapter 4 · Recipes

4.6Pins

A Pin holds a painted region in place, or makes it follow an object.

undo "TenPix: pin the waist" on (
    local p = tpaAddBelowSolver $Skirt (Tnpix_Pin())
    p.channel = "skirt_waist"        -- a channel on this stack
    p.weight = 1.0                   -- 1 follows fully; 0.5 follows half the motion and sags behind
    p.followObject = $Hips           -- undefined: the region holds in place
)
  • One Pin on the stack. TnpixTool.pinSet $Skirt "skirt_waist" 1.0 $Hips sets channel, weight and object in one undoable call. With more than one Pin, set the properties on the Pin you mean.
  • Hard and soft pins. For a hard pin, paint the region at 1 and use Weight 1. For a region that should hold almost firm, use a Weight of 0.9 to 0.99.
  • Dynamic. dynamic = true keeps the pinned points' mass, so gravity, damping and collision still act on them, and a released point keeps its own velocity. Off, the object moves the points directly; use that for cloth pinned to a body.
  • Release at a frame. activeTime = true with activeFrom and activeTo limits the pin to a frame range. At activeFrom the pin takes the points where they are; after activeTo it lets go.
  • Keep pinned points out of colliders. A pinned point inside a body jitters.
  • A part that follows the character's own animation, such as a cuff on a skinned arm, works better with Preserve (4.7). A Pin attaches each point to the nearest part of the object at the frame it takes hold, so with the arm close to the body, the armpit attaches to the body.