根据不同场景,可能会有多个相机切换的需求 ,通过scene.activeCamera即可实现。
例如:
// 1、创建多个相机const freeCamera = new BABYLON.FreeCamera('FreeCamera',new BABYLON.Vector3(-50, -8, -16),scene,)const arcRotateCamera = new BABYLON.ArcRotateCamera('ArcRotateCamera',0,0,0,new BABYLON.Vector3(0, 10, 0),scene,)
// 根据条件判断显示那个相机if(...) this._scene.activeCamera = this._camera