Physics · class
SkinnedCloth
A garment's particles, constraints and solver state, stepped at the set-up's fixed step. Read
positions after a step, or interpolate between the last two for a frame's alpha. The
schedule — poses, steps, resets, the blend — is ClothControl's; this is its CPU device.
Explained in Your first game, Rigid bodies.
class SkinnedClothimport { SkinnedCloth } from '@driftengine/physics';Constructor
new
constructor(setup: SkinnedClothSetup)| Parameter | Type | Description |
|---|---|---|
setup | SkinnedClothSetup |
Properties
| Name | Type | Description |
|---|---|---|
countreadonly | number | How many particles. |
positionsreadonly | Float32Array | Where each particle is now, three floats a particle. |
velocitiesreadonly | Float32Array | Metres a second, three floats a particle. |
inverseMassreadonly | Float32Array | |
parametersreadonly | ResolvedClothParameters | The parameters with their defaults filled in. |
Accessors
| Name | Type | Description |
|---|---|---|
alphaget | number | How far the time handed to advance reaches into the next step, 0 to 1. |
Methods
setWind
setWind(x: number, y: number, z: number): voidThe air the steps to come drag the cloth toward, world space, metres a second: the frame's
sample of the scene's one wind, so a garment moves with the smoke and the grass rather than
with a second wind of its own. See AGENTS.md, "One wind, sampled once".
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number |
setPose
setPose(globals: Float32Array, model: Float32Array): voidSee ClothControl.setPose.
| Parameter | Type | Description |
|---|---|---|
globals | Float32Array | |
model | Float32Array |
reset
reset(): voidSee ClothControl.reset.
advance
advance(dt: number): numberSee ClothControl.advance.
| Parameter | Type | Description |
|---|---|---|
dt | number |
interpolate
interpolate(alpha: number, out: Float32Array): voidEach particle between the start and the end of the last step, at alpha, into out.
| Parameter | Type | Description |
|---|---|---|
alpha | number | |
out | Float32Array |
step
step(): voidOne fixed step, all the way to the latest pose: for a caller in the engine's fixed-step loop.