1
This commit is contained in:
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user