Hide canvas until XR camera positioned in ship cockpit
All checks were successful
Build / build (push) Successful in 1m0s
All checks were successful
Build / build (push) Successful in 1m0s
- Hide #gameCanvas by default in CSS (display: none) - Show canvas in setupXRCamera() after camera is parented to ship - Show canvas in flat mode fallback paths - Fix preloader to append to document.body (was hidden with #levelSelect) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
54d562d210
commit
dfa46c85a6
@ -107,6 +107,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
display: none; /* Hidden until camera is positioned in ship */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================================
|
/* ============================================================================
|
||||||
|
|||||||
@ -92,6 +92,11 @@ export function createLevelSelectedHandler(context: LevelSelectedContext): (e: C
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.debug('Failed to enter XR, will fall back to flat mode:', error);
|
log.debug('Failed to enter XR, will fall back to flat mode:', error);
|
||||||
DefaultScene.XR = null;
|
DefaultScene.XR = null;
|
||||||
|
// Show canvas for flat mode
|
||||||
|
const canvas = document.getElementById('gameCanvas');
|
||||||
|
if (canvas) {
|
||||||
|
canvas.style.display = 'block';
|
||||||
|
}
|
||||||
engine.runRenderLoop(() => {
|
engine.runRenderLoop(() => {
|
||||||
DefaultScene.MainScene.render();
|
DefaultScene.MainScene.render();
|
||||||
});
|
});
|
||||||
@ -154,6 +159,11 @@ export function createLevelSelectedHandler(context: LevelSelectedContext): (e: C
|
|||||||
log.debug('[Main] XR setup and mission brief complete');
|
log.debug('[Main] XR setup and mission brief complete');
|
||||||
} else {
|
} else {
|
||||||
log.info('[Main] XR not active yet - will use onInitialXRPoseSetObservable instead');
|
log.info('[Main] XR not active yet - will use onInitialXRPoseSetObservable instead');
|
||||||
|
// Show canvas for non-XR mode
|
||||||
|
const canvas = document.getElementById('gameCanvas');
|
||||||
|
if (canvas) {
|
||||||
|
canvas.style.display = 'block';
|
||||||
|
}
|
||||||
engine.runRenderLoop(() => {
|
engine.runRenderLoop(() => {
|
||||||
DefaultScene.MainScene.render();
|
DefaultScene.MainScene.render();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -106,6 +106,12 @@ export class Level1 implements Level {
|
|||||||
xr.baseExperience.camera.position = new Vector3(0, 1.2, 0);
|
xr.baseExperience.camera.position = new Vector3(0, 1.2, 0);
|
||||||
log.debug('[Level1] XR camera parented to cameraRig at position (0, 1.2, 0)');
|
log.debug('[Level1] XR camera parented to cameraRig at position (0, 1.2, 0)');
|
||||||
|
|
||||||
|
// Show the canvas now that camera is properly positioned in ship
|
||||||
|
const canvas = document.getElementById('gameCanvas');
|
||||||
|
if (canvas) {
|
||||||
|
canvas.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure render loop is running
|
// Ensure render loop is running
|
||||||
const engine = DefaultScene.MainScene.getEngine();
|
const engine = DefaultScene.MainScene.getEngine();
|
||||||
engine.runRenderLoop(() => {
|
engine.runRenderLoop(() => {
|
||||||
|
|||||||
@ -14,9 +14,6 @@ export class Preloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createUI(): void {
|
private createUI(): void {
|
||||||
const levelSelect = document.getElementById('levelSelect');
|
|
||||||
if (!levelSelect) return;
|
|
||||||
|
|
||||||
// Create preloader container
|
// Create preloader container
|
||||||
this.container = document.createElement('div');
|
this.container = document.createElement('div');
|
||||||
this.container.className = 'preloader';
|
this.container.className = 'preloader';
|
||||||
@ -45,7 +42,8 @@ export class Preloader {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
levelSelect.appendChild(this.container);
|
// Append to body so it's visible even when other UI elements are hidden
|
||||||
|
document.body.appendChild(this.container);
|
||||||
|
|
||||||
// Get references
|
// Get references
|
||||||
this.progressBar = document.getElementById('preloaderProgress');
|
this.progressBar = document.getElementById('preloaderProgress');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user