voxel-region-change

get events when the player changes voxels or chunks

voxel-region-change

get events when the player changes voxels or chunks

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

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])

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)]

BSD