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
| Parameter | Type | Description |
|---|---|---|
model | EntityModel | The rest model. |
point | Vec3 | Centre in the rest model's voxel coordinates (map a world hit back through the inverse bone matrix of the pose it hit). |
radius | number | In voxels; at least 0.5. |
opts? | WoundOptions | - |
Returns
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