The core Engine constructor uses the following options:
var defaultOptions = {
debug: false,
silent: false,
playerHeight: 1.8,
playerWidth: 0.6,
playerStart: [0, 10, 0],
playerAutoStep: false,
playerShadowComponent: true,
tickRate: 30, // ticks per second
maxRenderRate: 0, // max FPS, 0 for uncapped
blockTestDistance: 10,
stickyPointerLock: true,
dragCameraOutsidePointerLock: true,
stickyFullscreen: false,
skipDefaultHighlighting: false,
originRebaseDistance: 25,
}
Events:
tick => (dt)
dt
is (fixed) tick duration in msbeforeRender => (dt)
dt
is the time (in ms) since the most recent tickafterRender => (dt)
dt
is the time (in ms) since the most recent ticktargetBlockChanged => (blockInfo)
addingTerrainMesh => (mesh)
removingTerrainMesh => (mesh)
Callback to determine which voxels can be targeted. Defaults to a solidity check, but can be overridden with arbitrary logic.
How far to check for a solid voxel the player is currently looking at
Manages the game's camera, view angle, sensitivity, etc.
Child module for managing the game's container, canvas, etc.
Entity manager / Entity Component System (ECS)
Alias to noa.entities
Manages key and mouse input bindings
The game's max framerate (use 0
for uncapped)
Physics engine - solves collisions, properties, etc.
Entity id for the player entity
A registry where voxel/material properties are managed
Rendering manager
Dynamically updated object describing the currently targeted block.
Readonly
tickThe game's tick rate (number of ticks per second)
Multiplier for how fast time moves. Setting this to a value other than
1
will make the game speed up or slow down. This can significantly
affect how core systems behave (particularly physics!).
Version string, e.g. "0.25.4"
Manages the world, chunks, and all voxel data
String identifier for the current world. It's safe to ignore this if your game has only one level/world.
Precisely converts a world position to the current internal local frame of reference.
See /docs/positions.md
for more info.
Params:
global
: input position in global coordsglobalPrecise
: (optional) sub-voxel offset to the global positionlocal
: output array which will receive the resultPrecisely converts a world position to the current internal local frame of reference.
See /docs/positions.md
for more info.
Params:
local
: input array of local coordsglobal
: output array which receives the resultglobalPrecise
: (optional) sub-voxel offset to the output global positionIf both output arrays are passed in, global
will get int values and
globalPrecise
will get fractional parts. If only one array is passed in,
global
will get the whole output position.
Raycast through the world, returning a result object for any non-air block
See /docs/positions.md
for info on working with precise positions.
where to pick from (default: player's eye pos)
direction to pick along (default: camera vector)
pick distance (default: noa.blockTestDistance
)
which voxel IDs can be picked (default: any solid voxel)
Rest
...args: any[]Generated using TypeDoc
Main engine class.
Takes an object full of optional settings as a parameter.
Note that the options object is also passed to noa's child modules (Rendering, Container, etc). See docs for each module for their options.