voxolith

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

ParameterTypeDescription
modelEntityModelThe rest model; it must carry bones.
rigRig-
bonenumberIndex into rig.bones of the first bone to cut.
opts?WoundOptions-

Returns

Severed

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 });

On this page