voxolith
API reference@voxolith/gen-creatureFunctions

realSizeAt()

Whether atScale builds this creature at its real size in a world of voxelsPerMetre. Below minVoxelsPerMetre it cannot: atScale keeps shape.size at 0.7 so the legs stay two voxels thick, and the creature comes out larger than life (a rat is 0.86 m long at 50 vox/m, 2.15 m at 20). It is also false...

function realSizeAt(params: CreatureParams, voxelsPerMetre: number): boolean;

Defined in: presets.ts:116

Whether atScale builds this creature at its real size in a world of voxelsPerMetre. Below minVoxelsPerMetre it cannot: atScale keeps shape.size at 0.7 so the legs stay two voxels thick, and the creature comes out larger than life (a rat is 0.86 m long at 50 vox/m, 2.15 m at 20). It is also false above about 250 vox/m, where the size is held at its upper bound of 2 and the creature comes out smaller than life. Apps that only show creatures true to size ask this instead of hard-coding a scale.

Parameters

ParameterTypeDescription
paramsCreatureParamsAny creature params, as atScale takes them; not mutated.
voxelsPerMetrenumberThe world's scale.

Returns

boolean

True when atScale(params, voxelsPerMetre) needs no clamping.

Example

realSizeAt(PRESETS.rat, 100); // true: size 0.8, 0.5 m nose to tail tip
realSizeAt(PRESETS.rat, 50);  // false: held at size 0.7, 0.86 m long
if (realSizeAt(PRESETS.rat, vpm)) crowd.add(generateCreature(atScale(PRESETS.rat, vpm), rng).entity);

On this page