From 96ae0330644b205514f1bf238ee3c833895b443f Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Sat, 8 Nov 2025 05:25:16 -0600 Subject: [PATCH] Start physics recording when XR pose is set instead of during initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved recording start from level initialization to onInitialXRPoseSetObservable. This ensures the 30-second ring buffer only contains actual gameplay data, not loading screens or menu time. Recording now starts at the same time as the game timer, when the player enters VR and gameplay begins. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/level1.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/level1.ts b/src/level1.ts index be31179..e45b621 100644 --- a/src/level1.ts +++ b/src/level1.ts @@ -50,6 +50,12 @@ export class Level1 implements Level { this._ship.gameStats.startTimer(); debugLog('Game timer started'); + // Start physics recording when gameplay begins + if (this._physicsRecorder) { + this._physicsRecorder.startRingBuffer(); + debugLog('Physics recorder started'); + } + const observer = xr.input.onControllerAddedObservable.add((controller) => { debugLog('🎮 onControllerAddedObservable FIRED for:', controller.inputSource.handedness); this._ship.addController(controller); @@ -147,11 +153,10 @@ export class Level1 implements Level { } }); - // Initialize physics recorder + // Initialize physics recorder (but don't start it yet - will start on XR pose) setLoadingMessage("Initializing physics recorder..."); this._physicsRecorder = new PhysicsRecorder(DefaultScene.MainScene); - this._physicsRecorder.startRingBuffer(); - debugLog('Physics recorder initialized and running'); + debugLog('Physics recorder initialized (will start on XR pose)'); // Wire up recording keyboard shortcuts this._ship.keyboardInput.onRecordingActionObservable.add((action) => {