Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A three.js plugin that adds labels to your game players (avatars).

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time


Voxel-label is a voxeljs module that implements LabelPlugin, a three.js plugin that adds labels to your game players (avatars). It can work in single-player mode as well as with voxel-client for labelling all avatars in a multiplayer game.

Get it running on your machine

npm install

Run the start script:

npm start

This gets the server running on port 8080.

You may view a demo at The demo adds another player to the Hello World demo. This player gets a label, JayJay. The default Hello World player does not get a label. Click "R" to view both players.

View of both players



Initializes the LabelPlugin


require('voxel-label').label(labelText, avatar, game, client.playerID)

Create a label for a player:

playerLabel = LabelPlugin.label(labelText, avatar, game, client.playerID)

Multi-player mode:

Make sure that your application populates a registration objects that has a username for the other players ("others"). voxel-app-server has an example of how to do this.

The following code uses the emitter from voxel-client instance to check the update stream every second. It grabs the userInfo (player's username) from the update and adds it to the avatar. It only creates a label when the username does not match the playerId value in the labels array.

setTimeout(function() {
  client.emitter.on('update', function(updates) {
    Object.keys(updates.userInfo).map(function(playerId) {
      var update = updates.userInfo[playerId]
      if (playerId === self.playerID) return  // local playerId
      var playerSkin = this.others[playerId]
      if (playerSkin != null) {
        playerSkin.userInfo = update
        if (labels[playerId] !== playerSkin.userInfo.username) {
          var otherPlayerLabel = LabelPlugin.label(playerSkin.userInfo.username, playerSkin.mesh, game, playerId)
          labels[playerId] = playerSkin.userInfo.username
}, 1000)




Something went wrong with that request. Please try again.