Skip to content
nimadez edited this page Oct 2, 2024 · 1 revision

EXPERIMENTAL

Websockets are available for sending and receiving voxel data

  • Open Preferences menu
  • Enter websocket server address
  • Check "Enable Client"

Data

Each voxel has a position, hex color and visibility state

position: FLOAT OBJECT { x, y, z }
color: HEX STRING UPPERCASE (#FFFFFF - no opacity)
visible: BOOLEAN
idx: INTEGER (read-only)

Voxel builder uses right-handed coordinate system

Send JSON

const data = [];
for (let i = 0; i < length; i++) {
    data.push({
        position: { x: 0, y: 0, z: 0 },
        color: "#FFFFFF",
        visible: true
    });
}

websocket.send(JSON.stringify({
    voxels: data,
    is_clear: true // clear scene or add voxel
}));

Receive JSON

voxel = JSON.parse(msg).voxels[0]
voxel.position._x
voxel.position._y
voxel.position._z
voxel.color
voxel.visible
voxel.idx

Server Example

See 'scripts/ws-connect.py'

Clone this wiki locally