Skip to content

Drawing Tool Example

This example demonstrates how to implement a real-time 3D drawing tool in SightLab. It supports both desktop and VR head-mounted display (HMD) configurations and is designed to offer users an intuitive method to draw in space or on surfaces. Works for both single and Multi User SightLab

🛠️ Functionality Overview

This tool allows participants to draw lines in 3D space using controller or mouse inputs, switch between drawing modes, change colors, and clear drawings.

✅ Supported Features

3D line drawing in space or on surfaces

Color cycling

Drawing toggle mode (surface ↔ air)

Drawing reset/clear

🎮 Controls

Desktop Mode
Left Mouse Button (LMB): Start drawing

Right Mouse Button (RMB): Clear drawing

M Key: Cycle to the next color

Return Key: Toggle between drawing on surface or in the air

VR (HMD) Mode
Right Hand Grip Button: Start drawing

Left Hand Y Button: Clear drawing

Left Hand Grip: Cycle to the next color

Left Hand X Button: Toggle surface/air drawing mode

🔧 Technical Notes

The Pencil tool (from the tools.pencil module) handles the actual drawing logic.

A red arrow is visually linked to the drawing controller or mouse to indicate drawing direction.

The drawing behavior switches based on the mode (draw() vs. project()).

Controller events are mapped using SightLab’s internal viz.getEventID() mappings for both desktop and VR interactions.

📦 Usage

This tool is ideal for:

Interactive experiments: Let participants express or trace shapes in 3D.

Design or training sessions: Enable freeform sketching on virtual whiteboards or models.

Was this page helpful?