-
Notifications
You must be signed in to change notification settings - Fork 22
WebSocket Client
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"
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
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
}));
voxel = JSON.parse(msg).voxels[0]
voxel.position._x
voxel.position._y
voxel.position._z
voxel.color
voxel.visible
voxel.idx
See 'scripts/ws-connect.py'