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 ClothTargets
import { ClothTargets } from '@driftengine/physics';

Constructor

new

constructor(setup: SkinnedClothSetup, particlesOnCpu?: boolean)
ParameterTypeDescription
setupSkinnedClothSetup
particlesOnCpu?boolean

Properties

NameTypeDescription
positionreadonlyFloat32ArrayWhere skinning puts each particle at the step being taken.
normalreadonlyFloat32ArrayIts skinned normal at the latest pose.
modelNowreadonlyFloat32Array<ArrayBuffer>The model matrix at the step being taken, and at the one before it.
modelBeforereadonlyFloat32Array<ArrayBuffer>
colliderEndsreadonlyFloat32ArrayEach collider's two ends, six floats a collider, at the latest pose.
colliderRadiireadonlyFloat32ArrayEach collider's two radii.
posedbooleanWhether a pose has been given at all.
skinreadonlyFloat32Array | nullmodel × global × inverse bind a joint at the latest pose, or null for a cloth with no rig.

Accessors

NameTypeDescription
modelgetFloat32ArrayThe model matrix the latest pose was given at.
latestgetFloat32ArrayThe latest skinned positions, which reset puts every particle at.

Methods

pose

pose(globals: Float32Array, model: Float32Array): void

Take a new pose: the old one becomes where this frame's steps start from.

ParameterTypeDescription
globalsFloat32Array
modelFloat32Array

settle

settle(): void

Forget the pose before the latest: steps start where the latest one is.

consume

consume(): void

The 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): void

The skinned positions and the model matrix fraction of the way from the last pose to this one.

ParameterTypeDescription
fractionnumber