This commit is contained in:
2026-03-11 11:56:46 +08:00
parent ae59fbe68b
commit 7fdbf19951
9 changed files with 613 additions and 12 deletions

View File

@ -21,13 +21,18 @@ export class AppCamera extends Monobehiver {
const canvas = AppConfig.container;
if (!scene || !canvas) return;
// 创建弧形旋转相机水平角70度垂直角80度距离5目标点(0,1,0)
this.object = new ArcRotateCamera('Camera', Tools.ToRadians(70), Tools.ToRadians(80), 5, new Vector3(0, 0, 0), scene);
// 创建弧形旋转相机水平角70度垂直角85度接近上帝视角距离5目标点(0,2,0)
this.object = new ArcRotateCamera('Camera', Tools.ToRadians(70), Tools.ToRadians(85), 5, new Vector3(0, 2, 0), scene);
this.object.attachControl(canvas, true);
this.object.minZ = 0.01; // 近裁剪面
this.object.wheelPrecision =999999; // 滚轮缩放精度
this.object.panningSensibility = 0;
this.object.position = new Vector3(-0, 0, 100);
// 限制垂直角范围,实现上帝视角
this.object.upperBetaLimit = Tools.ToRadians(60); // 最大垂直角接近90度避免万向锁
this.object.lowerBetaLimit = Tools.ToRadians(60); // 最小垂直角
this.object.position = new Vector3(-0, 100, 0);
this.setTarget(0, 2, 0);
}
@ -43,8 +48,11 @@ export class AppCamera extends Monobehiver {
/** 重置相机到默认位置 */
reset(): void {
if (!this.object) return;
this.object.radius = 2; this.setTarget(0, 0, 0);
this.object.position = new Vector3(0, 1.5, 2);
this.object.radius = 5;
this.object.alpha = Tools.ToRadians(60); // 水平角
this.object.beta = Tools.ToRadians(60); // 垂直角(上帝视角)
this.setTarget(0, 2, 0);
this.object.position = new Vector3(-0, 100, 0);
}
update(): void {