voxolith

wound()

Remove the voxels within radius of a rest-space point and optionally paint a rim around the hole. Returns a new model (the input is not changed); keep it as the entity's rest model so the wound shows in every pose baked afterwards. A generator that layers its interior shows what is underneath,...

function wound(
   model: EntityModel, 
   point: Vec3, 
   radius: number, 
   opts?: WoundOptions
): EntityModel;

Defined in: engine/src/animation/damage.ts:34

Remove the voxels within radius of a rest-space point and optionally paint a rim around the hole. Returns a new model (the input is not changed); keep it as the entity's rest model so the wound shows in every pose baked afterwards. A generator that layers its interior shows what is underneath, and poses do not hide it behind rig.cover.

Parameters

ParameterTypeDescription
modelEntityModelThe rest model.
pointVec3Centre in the rest model's voxel coordinates (map a world hit back through the inverse bone matrix of the pose it hit).
radiusnumberIn voxels; at least 0.5.
opts?WoundOptions-

Returns

EntityModel

The wounded rest model; its bones are kept.

Example

rat.rest = wound(rat.rest, hitInRest, 2.2, { rim: ROLE.BLOOD });
member.damage = (member.damage ?? 0) + 1; // so a crowd stops reusing the old poses

On this page