Skip to content

Commit

Permalink
Fix camera aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
UX3D-kanzler committed Aug 27, 2024
1 parent d5e75b3 commit cfd4c55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit cfd4c55

Please sign in to comment.