voxel-region-change

0.1.0 • Public • Published

voxel-region-change

get events when the player changes voxels or chunks

npm install voxel-region-change

usage

var regionChange = require('voxel-region-change')

regionChange(spatialEE, aabb3D, regionWidth)

where spatialEE is a spatial event emitter, aabb3D is a aabb-3d and regionWidth is some number

box is optional and will default to aabb3d([-Infinity, -Infinity, -Infinity], [Infinity, Infinity, Infinity])

regionChangeInstance.on('change', function(pos) {})

this will emit each time the spatial event emitter emits a region that is beyond your regionWidth. it will emit a position object with x, y and z equal to [Math.floor(pos.x / regionWidth), Math.floor(pos.y / regionWidth), Math.floor(pos.z / regionWidth)]

license

BSD

/voxel-region-change/

    Package Sidebar

    Install

    npm i voxel-region-change

    Weekly Downloads

    16

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • maxogden