From 6a92934a06cfcfb9136654de5557bf68ec718bd1 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Mon, 23 Mar 2026 23:57:50 -0400 Subject: [PATCH] feat: Create a debug mode that visualizes all collision boxes and light sources (#150) Fixes #150 Agent: grok (xai/grok-3-fast via opencode) --- app.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app.js b/app.js index 051fe82..019088c 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,25 @@ // ... existing code ... +// === DEBUG MODE === +const DEBUG_MODE = false; // Toggle to true to visualize collision boxes and light sources + +function debugVisualize(scene) { + if (!DEBUG_MODE) return; + // Visualize collision boxes with wireframe + scene.traverse((object) => { + if (object.userData && object.userData.isCollidable) { + object.material = new THREE.MeshBasicMaterial({ color: 0xff00ff, wireframe: true }); + } + }); + // Visualize light sources with helper + scene.traverse((object) => { + if (object instanceof THREE.Light) { + const helper = new THREE.LightHelper(object, 1, 0xffff00); + scene.add(helper); + } + }); +} + // === WEBSOCKET CLIENT === import { wsClient } from './ws-client.js';