voxel-portal
Create teleport portals for voxel.js textured with the camera view at the destination.
example
var createEngine = ;var game =;game;var explode = game;var erase = true;{ erase = !evctrlKey }game;// build back plates for the portals out of obsidian and netherrackfor var z = -225; z <= 200; z+= 425for var y = 50; y <= 175; y += 25for var x = -100; x <= 75; x += 25game;var createPortal = game;var a =;var b =;a;b;a;b;game;window;window;
methods
var voxelPortal =
var createPortal = voxelPortal(game)
Return a function for making portals given a voxel-engine game instance.
var portal = createPortal(opts)
Create a portal opts.width
width and opts.height
tall at
the coordinate (opts.x, opts.y, opts.z)
.
portal.show(target, direction)
Show the view from target
looking with the direction
vector.
target
can have a .position
or it can have .x
, .y
, and .z
fields
itself directly.
events
portal.on('enter', function () {})
When a player's position intersects the portal bounding box, this event fires.
It's up to you to teleport the player from here.
install
With npm do:
npm install voxel-portal
Use browserify to require('voxel-portal')
.
license
MIT