From cfd4c55c98a040925f867effb6e5f8a02fbefe7d Mon Sep 17 00:00:00 2001 From: Mathias Kanzler Date: Tue, 27 Aug 2024 18:42:17 +0200 Subject: [PATCH] Fix camera aspect ratio --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 9e444140..ab1d7a04 100644 --- a/src/main.js +++ b/src/main.js @@ -131,7 +131,7 @@ export default async () => { } const scene = state.gltf.scenes[state.sceneIndex]; scene.applyTransformHierarchy(state.gltf); - state.userCamera.aspectRatio = canvas.width / canvas.height; + state.userCamera.perspective.aspectRatio = canvas.width / canvas.height; state.userCamera.resetView(state.gltf, state.sceneIndex); // Try to start as many animations as possible without generating conficts. @@ -458,7 +458,7 @@ export default async () => { if((canvas.width/past.width <0.5 || canvas.width/past.width>2.0 )|| (canvas.height/past.height <0.5 || canvas.height/past.height>2.0 )) { - state.userCamera.aspectRatio = canvas.width / canvas.height; + state.userCamera.perspective.aspectRatio = canvas.width / canvas.height; state.userCamera.fitViewToScene(state.gltf, state.sceneIndex); }