Skip to content

Commit

Permalink
fix: model angle problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Dec 5, 2024
1 parent 35cc781 commit b2db400
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libs/vrmViewer/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,13 @@ export class Viewer {
this._camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 2000);
this._camera.position.set(0, 1.5, 2.0);

// camera 控制
// camera 控制 - 添加一些限制
this._cameraControls = new OrbitControls(this._camera, this._renderer.domElement);
this._cameraControls.screenSpacePanning = true;
this._cameraControls?.target.set(0, 0, 0);
this._cameraControls.target.set(0, 1.0, 0); // 将目标点稍微抬高
// this._cameraControls.minDistance = 1.0; // 设置最小距离
// this._cameraControls.maxDistance = 5.0; // 设置最大距离
// this._cameraControls.maxPolarAngle = Math.PI * 0.75; // 限制相机俯仰角度
this._cameraControls.update();

// Audio 音频播放
Expand Down

0 comments on commit b2db400

Please sign in to comment.