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
| Parameter | Type | Description |
|---|---|---|
params | CreatureParams | Any creature params, as atScale takes them; not mutated. |
voxelsPerMetre | number | The 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);minVoxelsPerMetre()
The smallest world scale, in voxels per metre, at which atScale builds this creature at its real size (see realSizeAt): about 84 for the default rat (size 1.2), 88 for the fat rat (1.15). Scales from here up to about 250 vox/m are real size. The size snaps to a 0.05 grid, so this is where the...
registerCreatureGenerators()
Register the creature generator with the engine registry.