Skip to content

Commit

Permalink
控制相机方向
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaxiangfeng committed Nov 2, 2022
1 parent a76d880 commit 56ee72a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/useScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function useScene(canvas: any, backgroundColor: string, isRotation?: boolean) {

cameraRef.current = camera;

camera.up.set(0, 1, 0);
camera.position.set(0, 0, 0);

const scene = new THREE.Scene();
Expand All @@ -63,6 +64,7 @@ function useScene(canvas: any, backgroundColor: string, isRotation?: boolean) {
renderer.outputEncoding = THREE.sRGBEncoding;

const controls = new OrbitControls(camera, renderer.domElement);

controls.addEventListener('change', render); // use if there is no animation loop
controls.update();

Expand Down

0 comments on commit 56ee72a

Please sign in to comment.