diff --git a/assets/libs/camera/OrbitCamera.ts b/assets/libs/camera/OrbitCamera.ts index a8fb8da..0b4b637 100644 --- a/assets/libs/camera/OrbitCamera.ts +++ b/assets/libs/camera/OrbitCamera.ts @@ -144,7 +144,7 @@ export class OrbitCamera extends Component { input.on(Input.EventType.MOUSE_WHEEL, this.onMouseWheel, this); } - this.resetTargetRotation(); + if (this.target) this.resetTargetRotation(); // 根据欧拉角信息计算摄像机四元数,旋转顺序为 YZX Quat.fromEuler(this._rotation, this._targetRotation.x, this._targetRotation.y, this._targetRotation.z); @@ -164,7 +164,7 @@ export class OrbitCamera extends Component { let targetRotation: Vec3 = this._targetRotation.set(this._startRotation); if (this.followTargetRotationY) { targetRotation = tempVec3_2.set(targetRotation); - Quat.toEuler(tempVec3, this.target!.worldRotation); + Quat.toEuler(tempVec3, this.target.worldRotation); targetRotation.add(tempVec3); } } diff --git a/assets/module/config/GameConfig.ts b/assets/module/config/GameConfig.ts index 41ecf5a..9d7e145 100644 --- a/assets/module/config/GameConfig.ts +++ b/assets/module/config/GameConfig.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2021-07-03 16:13:17 * @LastEditors: dgflash - * @LastEditTime: 2022-09-06 17:29:04 + * @LastEditTime: 2022-11-01 15:26:26 */ import { oops } from "../../core/Oops"; @@ -52,6 +52,11 @@ export class GameConfig { } private _data: any = null; + /** 游戏配置数据 */ + public get data(): any { + return this._data; + } + constructor(config: any) { let data = config.json; this._data = Object.freeze(data);