Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including voxel-region-change with all npm packages installed. Try it out:

var voxelRegionChange = require("voxel-region-change")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

voxel-region-change v0.1.0

get events when the player changes voxels or chunks


get events when the player changes voxels or chunks

npm install voxel-region-change


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



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free