Physics · class
ClothTargets
Skinned positions and normals from the last two poses, and the model matrices between.
Explained in Your first game, Rigid bodies.
class ClothTargetsimport { ClothTargets } from '@driftengine/physics';Constructor
new
constructor(setup: SkinnedClothSetup, particlesOnCpu?: boolean)| Parameter | Type | Description |
|---|---|---|
setup | SkinnedClothSetup | |
particlesOnCpu? | boolean |
Properties
| Name | Type | Description |
|---|---|---|
positionreadonly | Float32Array | Where skinning puts each particle at the step being taken. |
normalreadonly | Float32Array | Its skinned normal at the latest pose. |
modelNowreadonly | Float32Array<ArrayBuffer> | The model matrix at the step being taken, and at the one before it. |
modelBeforereadonly | Float32Array<ArrayBuffer> | |
colliderEndsreadonly | Float32Array | Each collider's two ends, six floats a collider, at the latest pose. |
colliderRadiireadonly | Float32Array | Each collider's two radii. |
posed | boolean | Whether a pose has been given at all. |
skinreadonly | Float32Array | null | model × global × inverse bind a joint at the latest pose, or null for a cloth with no rig. |
Accessors
| Name | Type | Description |
|---|---|---|
modelget | Float32Array | The model matrix the latest pose was given at. |
latestget | Float32Array | The latest skinned positions, which reset puts every particle at. |
Methods
pose
pose(globals: Float32Array, model: Float32Array): voidTake a new pose: the old one becomes where this frame's steps start from.
| Parameter | Type | Description |
|---|---|---|
globals | Float32Array | |
model | Float32Array |
settle
settle(): voidForget the pose before the latest: steps start where the latest one is.
consume
consume(): voidThe steps of a frame have run: the next frame's start from this pose, not the one before it, or a frame given no new pose would interpolate back from the old one and jump the cloth.
at
at(fraction: number): voidThe skinned positions and the model matrix fraction of the way from the last pose to this one.
| Parameter | Type | Description |
|---|---|---|
fraction | number |