get events when the player changes voxels or chunks
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
demo.js
index.html
index.js
logo-white.png
package.json

README.md

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