sever()
Cut a bone and everything below it off the model. The stump and the cut face of the piece get the rim role (blood, raw flesh) when given. Pure: the input model is not changed, and throwing the piece around is the game's job.
function sever(
model: EntityModel,
rig: Rig,
bone: number,
opts?: WoundOptions
): Severed;Defined in: engine/src/animation/damage.ts:84
Parameters
| Parameter | Type | Description |
|---|---|---|
model | EntityModel | The rest model; it must carry bones. |
rig | Rig | - |
bone | number | Index into rig.bones of the first bone to cut. |
opts? | WoundOptions | - |
Returns
The remaining body and the piece, or piece: null when the subtree owns no voxels.
Example
const { body, piece } = sever(rat.rest, rig, tailBone, { rim: ROLE.BLOOD });
rat.rest = body;
if (piece) gibs.push({ model: piece.model, rig: piece.rig, x, y, z });sampleClip()
Sample a clip at time t seconds (wrapped for looping clips, clamped otherwise), slerping between keys. Bones without a track stay at rest. Clips are authored at 12 fps; sampling at whole frames (frame / 12) is what lets baked poses be cached.
subtree()
Every bone in the subtree rooted at bone.