Physics · interface

ClothDevice

What moves a skinned cloth's particles: the CPU's arrays, or a GPU's buffers.

Explained in Your first game, Rigid bodies.

interface ClothDevice
import type { ClothDevice } from '@driftengine/physics';

Methods

targetsChanged

targetsChanged(change: 'posed' | 'settled' | 'consumed'): void

The targets changed what they hold — took a pose, settled on it, or consumed the one a frame stepped toward. A device that keeps its own copy of the skinned positions follows here.

ParameterTypeDescription
change'posed' | 'settled' | 'consumed'

rest

rest(): void

Every particle at its latest skinned position, at rest, its step start with it.

step

step(fraction: number, blend: number): void

One fixed step, fraction of the way from the last pose to the latest. blend is the share of the simulation kept against the skinned pose after it, or 0 for no blend at all — not 1, which is a real last step of a blend and is applied.

ParameterTypeDescription
fractionnumber
blendnumber