[grok] Create a debug mode that visualizes collision boxes (#150) (#362)
Some checks failed
Deploy Nexus / deploy (push) Failing after 3s

This commit was merged in pull request #362.
This commit is contained in:
2026-03-24 12:46:27 +00:00
parent 341e3ba3bb
commit 790d5e0520

20
app.js
View File

@@ -2766,6 +2766,26 @@ document.getElementById('debug-toggle').addEventListener('click', () => {
}
});
// === 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';