Start physics recording when XR pose is set instead of during initialization
All checks were successful
Build / build (push) Successful in 1m19s

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 <noreply@anthropic.com>
This commit is contained in:
Michael Mainguy 2025-11-08 05:25:16 -06:00
parent d8571ef740
commit 96ae033064

View File

@ -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) => {