arcRotateCamera.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. import { __decorate } from "../tslib.es6.js";
  2. import { serialize, serializeAsVector3, serializeAsMeshReference, serializeAsVector2 } from "../Misc/decorators.js";
  3. import { Observable } from "../Misc/observable.js";
  4. import { Matrix, Vector3, Vector2, TmpVectors } from "../Maths/math.vector.js";
  5. import { Node } from "../node.js";
  6. import { Mesh } from "../Meshes/mesh.js";
  7. import { AutoRotationBehavior } from "../Behaviors/Cameras/autoRotationBehavior.js";
  8. import { BouncingBehavior } from "../Behaviors/Cameras/bouncingBehavior.js";
  9. import { FramingBehavior } from "../Behaviors/Cameras/framingBehavior.js";
  10. import { Camera } from "./camera.js";
  11. import { TargetCamera } from "./targetCamera.js";
  12. import { ArcRotateCameraInputsManager } from "../Cameras/arcRotateCameraInputsManager.js";
  13. import { Epsilon } from "../Maths/math.constants.js";
  14. import { Tools } from "../Misc/tools.js";
  15. Node.AddNodeConstructor("ArcRotateCamera", (name, scene) => {
  16. return () => new ArcRotateCamera(name, 0, 0, 1.0, Vector3.Zero(), scene);
  17. });
  18. /**
  19. * This represents an orbital type of camera.
  20. *
  21. * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.
  22. * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.
  23. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#arc-rotate-camera
  24. */
  25. export class ArcRotateCamera extends TargetCamera {
  26. /**
  27. * Defines the target point of the camera.
  28. * The camera looks towards it from the radius distance.
  29. */
  30. get target() {
  31. return this._target;
  32. }
  33. set target(value) {
  34. this.setTarget(value);
  35. }
  36. /**
  37. * Defines the target transform node of the camera.
  38. * The camera looks towards it from the radius distance.
  39. * Please note that setting a target host will disable panning.
  40. */
  41. get targetHost() {
  42. return this._targetHost;
  43. }
  44. set targetHost(value) {
  45. if (value) {
  46. this.setTarget(value);
  47. }
  48. }
  49. /**
  50. * Return the current target position of the camera. This value is expressed in local space.
  51. * @returns the target position
  52. */
  53. getTarget() {
  54. return this.target;
  55. }
  56. /**
  57. * Define the current local position of the camera in the scene
  58. */
  59. get position() {
  60. return this._position;
  61. }
  62. set position(newPosition) {
  63. this.setPosition(newPosition);
  64. }
  65. /**
  66. * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())
  67. * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.
  68. * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.
  69. */
  70. set upVector(vec) {
  71. if (!this._upToYMatrix) {
  72. this._yToUpMatrix = new Matrix();
  73. this._upToYMatrix = new Matrix();
  74. this._upVector = Vector3.Zero();
  75. }
  76. vec.normalize();
  77. this._upVector.copyFrom(vec);
  78. this.setMatUp();
  79. }
  80. get upVector() {
  81. return this._upVector;
  82. }
  83. /**
  84. * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.
  85. */
  86. setMatUp() {
  87. // from y-up to custom-up (used in _getViewMatrix)
  88. Matrix.RotationAlignToRef(Vector3.UpReadOnly, this._upVector, this._yToUpMatrix);
  89. // from custom-up to y-up (used in rebuildAnglesAndRadius)
  90. Matrix.RotationAlignToRef(this._upVector, Vector3.UpReadOnly, this._upToYMatrix);
  91. }
  92. //-- begin properties for backward compatibility for inputs
  93. /**
  94. * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.
  95. */
  96. get angularSensibilityX() {
  97. const pointers = this.inputs.attached["pointers"];
  98. if (pointers) {
  99. return pointers.angularSensibilityX;
  100. }
  101. return 0;
  102. }
  103. set angularSensibilityX(value) {
  104. const pointers = this.inputs.attached["pointers"];
  105. if (pointers) {
  106. pointers.angularSensibilityX = value;
  107. }
  108. }
  109. /**
  110. * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.
  111. */
  112. get angularSensibilityY() {
  113. const pointers = this.inputs.attached["pointers"];
  114. if (pointers) {
  115. return pointers.angularSensibilityY;
  116. }
  117. return 0;
  118. }
  119. set angularSensibilityY(value) {
  120. const pointers = this.inputs.attached["pointers"];
  121. if (pointers) {
  122. pointers.angularSensibilityY = value;
  123. }
  124. }
  125. /**
  126. * Gets or Set the pointer pinch precision or how fast is the camera zooming.
  127. */
  128. get pinchPrecision() {
  129. const pointers = this.inputs.attached["pointers"];
  130. if (pointers) {
  131. return pointers.pinchPrecision;
  132. }
  133. return 0;
  134. }
  135. set pinchPrecision(value) {
  136. const pointers = this.inputs.attached["pointers"];
  137. if (pointers) {
  138. pointers.pinchPrecision = value;
  139. }
  140. }
  141. /**
  142. * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.
  143. * It will be used instead of pinchPrecision if different from 0.
  144. * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.
  145. */
  146. get pinchDeltaPercentage() {
  147. const pointers = this.inputs.attached["pointers"];
  148. if (pointers) {
  149. return pointers.pinchDeltaPercentage;
  150. }
  151. return 0;
  152. }
  153. set pinchDeltaPercentage(value) {
  154. const pointers = this.inputs.attached["pointers"];
  155. if (pointers) {
  156. pointers.pinchDeltaPercentage = value;
  157. }
  158. }
  159. /**
  160. * Gets or Set the pointer use natural pinch zoom to override the pinch precision
  161. * and pinch delta percentage.
  162. * When useNaturalPinchZoom is true, multi touch zoom will zoom in such
  163. * that any object in the plane at the camera's target point will scale
  164. * perfectly with finger motion.
  165. */
  166. get useNaturalPinchZoom() {
  167. const pointers = this.inputs.attached["pointers"];
  168. if (pointers) {
  169. return pointers.useNaturalPinchZoom;
  170. }
  171. return false;
  172. }
  173. set useNaturalPinchZoom(value) {
  174. const pointers = this.inputs.attached["pointers"];
  175. if (pointers) {
  176. pointers.useNaturalPinchZoom = value;
  177. }
  178. }
  179. /**
  180. * Gets or Set the pointer panning sensibility or how fast is the camera moving.
  181. */
  182. get panningSensibility() {
  183. const pointers = this.inputs.attached["pointers"];
  184. if (pointers) {
  185. return pointers.panningSensibility;
  186. }
  187. return 0;
  188. }
  189. set panningSensibility(value) {
  190. const pointers = this.inputs.attached["pointers"];
  191. if (pointers) {
  192. pointers.panningSensibility = value;
  193. }
  194. }
  195. /**
  196. * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.
  197. */
  198. get keysUp() {
  199. const keyboard = this.inputs.attached["keyboard"];
  200. if (keyboard) {
  201. return keyboard.keysUp;
  202. }
  203. return [];
  204. }
  205. set keysUp(value) {
  206. const keyboard = this.inputs.attached["keyboard"];
  207. if (keyboard) {
  208. keyboard.keysUp = value;
  209. }
  210. }
  211. /**
  212. * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.
  213. */
  214. get keysDown() {
  215. const keyboard = this.inputs.attached["keyboard"];
  216. if (keyboard) {
  217. return keyboard.keysDown;
  218. }
  219. return [];
  220. }
  221. set keysDown(value) {
  222. const keyboard = this.inputs.attached["keyboard"];
  223. if (keyboard) {
  224. keyboard.keysDown = value;
  225. }
  226. }
  227. /**
  228. * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.
  229. */
  230. get keysLeft() {
  231. const keyboard = this.inputs.attached["keyboard"];
  232. if (keyboard) {
  233. return keyboard.keysLeft;
  234. }
  235. return [];
  236. }
  237. set keysLeft(value) {
  238. const keyboard = this.inputs.attached["keyboard"];
  239. if (keyboard) {
  240. keyboard.keysLeft = value;
  241. }
  242. }
  243. /**
  244. * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.
  245. */
  246. get keysRight() {
  247. const keyboard = this.inputs.attached["keyboard"];
  248. if (keyboard) {
  249. return keyboard.keysRight;
  250. }
  251. return [];
  252. }
  253. set keysRight(value) {
  254. const keyboard = this.inputs.attached["keyboard"];
  255. if (keyboard) {
  256. keyboard.keysRight = value;
  257. }
  258. }
  259. /**
  260. * Gets or Set the mouse wheel precision or how fast is the camera zooming.
  261. */
  262. get wheelPrecision() {
  263. const mousewheel = this.inputs.attached["mousewheel"];
  264. if (mousewheel) {
  265. return mousewheel.wheelPrecision;
  266. }
  267. return 0;
  268. }
  269. set wheelPrecision(value) {
  270. const mousewheel = this.inputs.attached["mousewheel"];
  271. if (mousewheel) {
  272. mousewheel.wheelPrecision = value;
  273. }
  274. }
  275. /**
  276. * Gets or Set the boolean value that controls whether or not the mouse wheel
  277. * zooms to the location of the mouse pointer or not. The default is false.
  278. */
  279. get zoomToMouseLocation() {
  280. const mousewheel = this.inputs.attached["mousewheel"];
  281. if (mousewheel) {
  282. return mousewheel.zoomToMouseLocation;
  283. }
  284. return false;
  285. }
  286. set zoomToMouseLocation(value) {
  287. const mousewheel = this.inputs.attached["mousewheel"];
  288. if (mousewheel) {
  289. mousewheel.zoomToMouseLocation = value;
  290. }
  291. }
  292. /**
  293. * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.
  294. * It will be used instead of wheelPrecision if different from 0.
  295. * It defines the percentage of current camera.radius to use as delta when wheel zoom is used.
  296. */
  297. get wheelDeltaPercentage() {
  298. const mousewheel = this.inputs.attached["mousewheel"];
  299. if (mousewheel) {
  300. return mousewheel.wheelDeltaPercentage;
  301. }
  302. return 0;
  303. }
  304. set wheelDeltaPercentage(value) {
  305. const mousewheel = this.inputs.attached["mousewheel"];
  306. if (mousewheel) {
  307. mousewheel.wheelDeltaPercentage = value;
  308. }
  309. }
  310. /**
  311. * Gets the bouncing behavior of the camera if it has been enabled.
  312. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior
  313. */
  314. get bouncingBehavior() {
  315. return this._bouncingBehavior;
  316. }
  317. /**
  318. * Defines if the bouncing behavior of the camera is enabled on the camera.
  319. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior
  320. */
  321. get useBouncingBehavior() {
  322. return this._bouncingBehavior != null;
  323. }
  324. set useBouncingBehavior(value) {
  325. if (value === this.useBouncingBehavior) {
  326. return;
  327. }
  328. if (value) {
  329. this._bouncingBehavior = new BouncingBehavior();
  330. this.addBehavior(this._bouncingBehavior);
  331. }
  332. else if (this._bouncingBehavior) {
  333. this.removeBehavior(this._bouncingBehavior);
  334. this._bouncingBehavior = null;
  335. }
  336. }
  337. /**
  338. * Gets the framing behavior of the camera if it has been enabled.
  339. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior
  340. */
  341. get framingBehavior() {
  342. return this._framingBehavior;
  343. }
  344. /**
  345. * Defines if the framing behavior of the camera is enabled on the camera.
  346. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior
  347. */
  348. get useFramingBehavior() {
  349. return this._framingBehavior != null;
  350. }
  351. set useFramingBehavior(value) {
  352. if (value === this.useFramingBehavior) {
  353. return;
  354. }
  355. if (value) {
  356. this._framingBehavior = new FramingBehavior();
  357. this.addBehavior(this._framingBehavior);
  358. }
  359. else if (this._framingBehavior) {
  360. this.removeBehavior(this._framingBehavior);
  361. this._framingBehavior = null;
  362. }
  363. }
  364. /**
  365. * Gets the auto rotation behavior of the camera if it has been enabled.
  366. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior
  367. */
  368. get autoRotationBehavior() {
  369. return this._autoRotationBehavior;
  370. }
  371. /**
  372. * Defines if the auto rotation behavior of the camera is enabled on the camera.
  373. * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior
  374. */
  375. get useAutoRotationBehavior() {
  376. return this._autoRotationBehavior != null;
  377. }
  378. set useAutoRotationBehavior(value) {
  379. if (value === this.useAutoRotationBehavior) {
  380. return;
  381. }
  382. if (value) {
  383. this._autoRotationBehavior = new AutoRotationBehavior();
  384. this.addBehavior(this._autoRotationBehavior);
  385. }
  386. else if (this._autoRotationBehavior) {
  387. this.removeBehavior(this._autoRotationBehavior);
  388. this._autoRotationBehavior = null;
  389. }
  390. }
  391. /**
  392. * Instantiates a new ArcRotateCamera in a given scene
  393. * @param name Defines the name of the camera
  394. * @param alpha Defines the camera rotation along the longitudinal axis
  395. * @param beta Defines the camera rotation along the latitudinal axis
  396. * @param radius Defines the camera distance from its target
  397. * @param target Defines the camera target
  398. * @param scene Defines the scene the camera belongs to
  399. * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined
  400. */
  401. constructor(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive = true) {
  402. super(name, Vector3.Zero(), scene, setActiveOnSceneIfNoneActive);
  403. /**
  404. * Current inertia value on the longitudinal axis.
  405. * The bigger this number the longer it will take for the camera to stop.
  406. */
  407. this.inertialAlphaOffset = 0;
  408. /**
  409. * Current inertia value on the latitudinal axis.
  410. * The bigger this number the longer it will take for the camera to stop.
  411. */
  412. this.inertialBetaOffset = 0;
  413. /**
  414. * Current inertia value on the radius axis.
  415. * The bigger this number the longer it will take for the camera to stop.
  416. */
  417. this.inertialRadiusOffset = 0;
  418. /**
  419. * Minimum allowed angle on the longitudinal axis.
  420. * This can help limiting how the Camera is able to move in the scene.
  421. */
  422. this.lowerAlphaLimit = null;
  423. /**
  424. * Maximum allowed angle on the longitudinal axis.
  425. * This can help limiting how the Camera is able to move in the scene.
  426. */
  427. this.upperAlphaLimit = null;
  428. /**
  429. * Minimum allowed angle on the latitudinal axis.
  430. * This can help limiting how the Camera is able to move in the scene.
  431. */
  432. this.lowerBetaLimit = 0.01;
  433. /**
  434. * Maximum allowed angle on the latitudinal axis.
  435. * This can help limiting how the Camera is able to move in the scene.
  436. */
  437. this.upperBetaLimit = Math.PI - 0.01;
  438. /**
  439. * Minimum allowed distance of the camera to the target (The camera can not get closer).
  440. * This can help limiting how the Camera is able to move in the scene.
  441. */
  442. this.lowerRadiusLimit = null;
  443. /**
  444. * Maximum allowed distance of the camera to the target (The camera can not get further).
  445. * This can help limiting how the Camera is able to move in the scene.
  446. */
  447. this.upperRadiusLimit = null;
  448. /**
  449. * Defines the current inertia value used during panning of the camera along the X axis.
  450. */
  451. this.inertialPanningX = 0;
  452. /**
  453. * Defines the current inertia value used during panning of the camera along the Y axis.
  454. */
  455. this.inertialPanningY = 0;
  456. /**
  457. * Defines the distance used to consider the camera in pan mode vs pinch/zoom.
  458. * Basically if your fingers moves away from more than this distance you will be considered
  459. * in pinch mode.
  460. */
  461. this.pinchToPanMaxDistance = 20;
  462. /**
  463. * Defines the maximum distance the camera can pan.
  464. * This could help keeping the camera always in your scene.
  465. */
  466. this.panningDistanceLimit = null;
  467. /**
  468. * Defines the target of the camera before panning.
  469. */
  470. this.panningOriginTarget = Vector3.Zero();
  471. /**
  472. * Defines the value of the inertia used during panning.
  473. * 0 would mean stop inertia and one would mean no deceleration at all.
  474. */
  475. this.panningInertia = 0.9;
  476. //-- end properties for backward compatibility for inputs
  477. /**
  478. * Defines how much the radius should be scaled while zooming on a particular mesh (through the zoomOn function)
  479. */
  480. this.zoomOnFactor = 1;
  481. /**
  482. * Defines a screen offset for the camera position.
  483. */
  484. this.targetScreenOffset = Vector2.Zero();
  485. /**
  486. * Allows the camera to be completely reversed.
  487. * If false the camera can not arrive upside down.
  488. */
  489. this.allowUpsideDown = true;
  490. /**
  491. * Define if double tap/click is used to restore the previously saved state of the camera.
  492. */
  493. this.useInputToRestoreState = true;
  494. /** @internal */
  495. this._viewMatrix = new Matrix();
  496. /**
  497. * Defines the allowed panning axis.
  498. */
  499. this.panningAxis = new Vector3(1, 1, 0);
  500. this._transformedDirection = new Vector3();
  501. /**
  502. * Defines if camera will eliminate transform on y axis.
  503. */
  504. this.mapPanning = false;
  505. /**
  506. * Observable triggered when the transform node target has been changed on the camera.
  507. */
  508. this.onMeshTargetChangedObservable = new Observable();
  509. /**
  510. * Defines whether the camera should check collision with the objects oh the scene.
  511. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#how-can-i-do-this-
  512. */
  513. this.checkCollisions = false;
  514. /**
  515. * Defines the collision radius of the camera.
  516. * This simulates a sphere around the camera.
  517. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#arcrotatecamera
  518. */
  519. this.collisionRadius = new Vector3(0.5, 0.5, 0.5);
  520. this._previousPosition = Vector3.Zero();
  521. this._collisionVelocity = Vector3.Zero();
  522. this._newPosition = Vector3.Zero();
  523. this._computationVector = Vector3.Zero();
  524. this._onCollisionPositionChange = (collisionId, newPosition, collidedMesh = null) => {
  525. if (!collidedMesh) {
  526. this._previousPosition.copyFrom(this._position);
  527. }
  528. else {
  529. this.setPosition(newPosition);
  530. if (this.onCollide) {
  531. this.onCollide(collidedMesh);
  532. }
  533. }
  534. // Recompute because of constraints
  535. const cosa = Math.cos(this.alpha);
  536. const sina = Math.sin(this.alpha);
  537. const cosb = Math.cos(this.beta);
  538. let sinb = Math.sin(this.beta);
  539. if (sinb === 0) {
  540. sinb = 0.0001;
  541. }
  542. const target = this._getTargetPosition();
  543. this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
  544. target.addToRef(this._computationVector, this._newPosition);
  545. this._position.copyFrom(this._newPosition);
  546. let up = this.upVector;
  547. if (this.allowUpsideDown && this.beta < 0) {
  548. up = up.clone();
  549. up = up.negate();
  550. }
  551. this._computeViewMatrix(this._position, target, up);
  552. this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);
  553. this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);
  554. this._collisionTriggered = false;
  555. };
  556. this._target = Vector3.Zero();
  557. if (target) {
  558. this.setTarget(target);
  559. }
  560. this.alpha = alpha;
  561. this.beta = beta;
  562. this.radius = radius;
  563. this.getViewMatrix();
  564. this.inputs = new ArcRotateCameraInputsManager(this);
  565. this.inputs.addKeyboard().addMouseWheel().addPointers();
  566. }
  567. // Cache
  568. /** @internal */
  569. _initCache() {
  570. super._initCache();
  571. this._cache._target = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
  572. this._cache.alpha = undefined;
  573. this._cache.beta = undefined;
  574. this._cache.radius = undefined;
  575. this._cache.targetScreenOffset = Vector2.Zero();
  576. }
  577. /**
  578. * @internal
  579. */
  580. _updateCache(ignoreParentClass) {
  581. if (!ignoreParentClass) {
  582. super._updateCache();
  583. }
  584. this._cache._target.copyFrom(this._getTargetPosition());
  585. this._cache.alpha = this.alpha;
  586. this._cache.beta = this.beta;
  587. this._cache.radius = this.radius;
  588. this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);
  589. }
  590. _getTargetPosition() {
  591. if (this._targetHost && this._targetHost.getAbsolutePosition) {
  592. const pos = this._targetHost.getAbsolutePosition();
  593. if (this._targetBoundingCenter) {
  594. pos.addToRef(this._targetBoundingCenter, this._target);
  595. }
  596. else {
  597. this._target.copyFrom(pos);
  598. }
  599. }
  600. const lockedTargetPosition = this._getLockedTargetPosition();
  601. if (lockedTargetPosition) {
  602. return lockedTargetPosition;
  603. }
  604. return this._target;
  605. }
  606. /**
  607. * Stores the current state of the camera (alpha, beta, radius and target)
  608. * @returns the camera itself
  609. */
  610. storeState() {
  611. this._storedAlpha = this.alpha;
  612. this._storedBeta = this.beta;
  613. this._storedRadius = this.radius;
  614. this._storedTarget = this._getTargetPosition().clone();
  615. this._storedTargetScreenOffset = this.targetScreenOffset.clone();
  616. return super.storeState();
  617. }
  618. /**
  619. * @internal
  620. * Restored camera state. You must call storeState() first
  621. */
  622. _restoreStateValues() {
  623. if (!super._restoreStateValues()) {
  624. return false;
  625. }
  626. this.setTarget(this._storedTarget.clone());
  627. this.alpha = this._storedAlpha;
  628. this.beta = this._storedBeta;
  629. this.radius = this._storedRadius;
  630. this.targetScreenOffset = this._storedTargetScreenOffset.clone();
  631. this.inertialAlphaOffset = 0;
  632. this.inertialBetaOffset = 0;
  633. this.inertialRadiusOffset = 0;
  634. this.inertialPanningX = 0;
  635. this.inertialPanningY = 0;
  636. return true;
  637. }
  638. // Synchronized
  639. /** @internal */
  640. _isSynchronizedViewMatrix() {
  641. if (!super._isSynchronizedViewMatrix()) {
  642. return false;
  643. }
  644. return (this._cache._target.equals(this._getTargetPosition()) &&
  645. this._cache.alpha === this.alpha &&
  646. this._cache.beta === this.beta &&
  647. this._cache.radius === this.radius &&
  648. this._cache.targetScreenOffset.equals(this.targetScreenOffset));
  649. }
  650. /**
  651. * Attached controls to the current camera.
  652. * @param ignored defines an ignored parameter kept for backward compatibility.
  653. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  654. * @param useCtrlForPanning Defines whether ctrl is used for panning within the controls
  655. * @param panningMouseButton Defines whether panning is allowed through mouse click button
  656. */
  657. attachControl(ignored, noPreventDefault, useCtrlForPanning = true, panningMouseButton = 2) {
  658. // eslint-disable-next-line prefer-rest-params
  659. const args = arguments;
  660. noPreventDefault = Tools.BackCompatCameraNoPreventDefault(args);
  661. this._useCtrlForPanning = useCtrlForPanning;
  662. this._panningMouseButton = panningMouseButton;
  663. // backwards compatibility
  664. if (typeof args[0] === "boolean") {
  665. if (args.length > 1) {
  666. this._useCtrlForPanning = args[1];
  667. }
  668. if (args.length > 2) {
  669. this._panningMouseButton = args[2];
  670. }
  671. }
  672. this.inputs.attachElement(noPreventDefault);
  673. this._reset = () => {
  674. this.inertialAlphaOffset = 0;
  675. this.inertialBetaOffset = 0;
  676. this.inertialRadiusOffset = 0;
  677. this.inertialPanningX = 0;
  678. this.inertialPanningY = 0;
  679. };
  680. }
  681. /**
  682. * Detach the current controls from the specified dom element.
  683. */
  684. detachControl() {
  685. this.inputs.detachElement();
  686. if (this._reset) {
  687. this._reset();
  688. }
  689. }
  690. /** @internal */
  691. _checkInputs() {
  692. //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.
  693. if (this._collisionTriggered) {
  694. return;
  695. }
  696. this.inputs.checkInputs();
  697. // Inertia
  698. if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
  699. const directionModifier = this.invertRotation ? -1 : 1;
  700. const handednessMultiplier = this._calculateHandednessMultiplier();
  701. let inertialAlphaOffset = this.inertialAlphaOffset * handednessMultiplier;
  702. if (this.beta < 0) {
  703. inertialAlphaOffset *= -1;
  704. }
  705. this.alpha += inertialAlphaOffset * directionModifier;
  706. this.beta += this.inertialBetaOffset * directionModifier;
  707. this.radius -= this.inertialRadiusOffset;
  708. this.inertialAlphaOffset *= this.inertia;
  709. this.inertialBetaOffset *= this.inertia;
  710. this.inertialRadiusOffset *= this.inertia;
  711. if (Math.abs(this.inertialAlphaOffset) < Epsilon) {
  712. this.inertialAlphaOffset = 0;
  713. }
  714. if (Math.abs(this.inertialBetaOffset) < Epsilon) {
  715. this.inertialBetaOffset = 0;
  716. }
  717. if (Math.abs(this.inertialRadiusOffset) < this.speed * Epsilon) {
  718. this.inertialRadiusOffset = 0;
  719. }
  720. }
  721. // Panning inertia
  722. if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {
  723. const localDirection = new Vector3(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);
  724. this._viewMatrix.invertToRef(this._cameraTransformMatrix);
  725. localDirection.multiplyInPlace(this.panningAxis);
  726. Vector3.TransformNormalToRef(localDirection, this._cameraTransformMatrix, this._transformedDirection);
  727. // If mapPanning is enabled, we need to take the upVector into account and
  728. // make sure we're not panning in the y direction
  729. if (this.mapPanning) {
  730. const up = this.upVector;
  731. const right = Vector3.CrossToRef(this._transformedDirection, up, this._transformedDirection);
  732. Vector3.CrossToRef(up, right, this._transformedDirection);
  733. }
  734. else if (!this.panningAxis.y) {
  735. this._transformedDirection.y = 0;
  736. }
  737. if (!this._targetHost) {
  738. if (this.panningDistanceLimit) {
  739. this._transformedDirection.addInPlace(this._target);
  740. const distanceSquared = Vector3.DistanceSquared(this._transformedDirection, this.panningOriginTarget);
  741. if (distanceSquared <= this.panningDistanceLimit * this.panningDistanceLimit) {
  742. this._target.copyFrom(this._transformedDirection);
  743. }
  744. }
  745. else {
  746. if (this.parent) {
  747. const m = TmpVectors.Matrix[0];
  748. this.parent.getWorldMatrix().getRotationMatrixToRef(m);
  749. m.transposeToRef(m);
  750. Vector3.TransformCoordinatesToRef(this._transformedDirection, m, this._transformedDirection);
  751. }
  752. this._target.addInPlace(this._transformedDirection);
  753. }
  754. }
  755. this.inertialPanningX *= this.panningInertia;
  756. this.inertialPanningY *= this.panningInertia;
  757. if (Math.abs(this.inertialPanningX) < this.speed * Epsilon) {
  758. this.inertialPanningX = 0;
  759. }
  760. if (Math.abs(this.inertialPanningY) < this.speed * Epsilon) {
  761. this.inertialPanningY = 0;
  762. }
  763. }
  764. // Limits
  765. this._checkLimits();
  766. super._checkInputs();
  767. }
  768. _checkLimits() {
  769. if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {
  770. if (this.allowUpsideDown && this.beta > Math.PI) {
  771. this.beta = this.beta - 2 * Math.PI;
  772. }
  773. }
  774. else {
  775. if (this.beta < this.lowerBetaLimit) {
  776. this.beta = this.lowerBetaLimit;
  777. }
  778. }
  779. if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {
  780. if (this.allowUpsideDown && this.beta < -Math.PI) {
  781. this.beta = this.beta + 2 * Math.PI;
  782. }
  783. }
  784. else {
  785. if (this.beta > this.upperBetaLimit) {
  786. this.beta = this.upperBetaLimit;
  787. }
  788. }
  789. if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {
  790. this.alpha = this.lowerAlphaLimit;
  791. }
  792. if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {
  793. this.alpha = this.upperAlphaLimit;
  794. }
  795. if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {
  796. this.radius = this.lowerRadiusLimit;
  797. this.inertialRadiusOffset = 0;
  798. }
  799. if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {
  800. this.radius = this.upperRadiusLimit;
  801. this.inertialRadiusOffset = 0;
  802. }
  803. }
  804. /**
  805. * Rebuilds angles (alpha, beta) and radius from the give position and target
  806. */
  807. rebuildAnglesAndRadius() {
  808. this._position.subtractToRef(this._getTargetPosition(), this._computationVector);
  809. // need to rotate to Y up equivalent if up vector not Axis.Y
  810. if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {
  811. Vector3.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);
  812. }
  813. this.radius = this._computationVector.length();
  814. if (this.radius === 0) {
  815. this.radius = 0.0001; // Just to avoid division by zero
  816. }
  817. // Alpha
  818. const previousAlpha = this.alpha;
  819. if (this._computationVector.x === 0 && this._computationVector.z === 0) {
  820. this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)
  821. }
  822. else {
  823. this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));
  824. }
  825. if (this._computationVector.z < 0) {
  826. this.alpha = 2 * Math.PI - this.alpha;
  827. }
  828. // Calculate the number of revolutions between the new and old alpha values.
  829. const alphaCorrectionTurns = Math.round((previousAlpha - this.alpha) / (2.0 * Math.PI));
  830. // Adjust alpha so that its numerical representation is the closest one to the old value.
  831. this.alpha += alphaCorrectionTurns * 2.0 * Math.PI;
  832. // Beta
  833. this.beta = Math.acos(this._computationVector.y / this.radius);
  834. this._checkLimits();
  835. }
  836. /**
  837. * Use a position to define the current camera related information like alpha, beta and radius
  838. * @param position Defines the position to set the camera at
  839. */
  840. setPosition(position) {
  841. if (this._position.equals(position)) {
  842. return;
  843. }
  844. this._position.copyFrom(position);
  845. this.rebuildAnglesAndRadius();
  846. }
  847. /**
  848. * Defines the target the camera should look at.
  849. * This will automatically adapt alpha beta and radius to fit within the new target.
  850. * Please note that setting a target as a mesh will disable panning.
  851. * @param target Defines the new target as a Vector or a transform node
  852. * @param toBoundingCenter In case of a mesh target, defines whether to target the mesh position or its bounding information center
  853. * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)
  854. * @param cloneAlphaBetaRadius If true, replicate the current setup (alpha, beta, radius) on the new target
  855. */
  856. setTarget(target, toBoundingCenter = false, allowSamePosition = false, cloneAlphaBetaRadius = false) {
  857. cloneAlphaBetaRadius = this.overrideCloneAlphaBetaRadius ?? cloneAlphaBetaRadius;
  858. if (target.computeWorldMatrix) {
  859. if (toBoundingCenter && target.getBoundingInfo) {
  860. this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();
  861. }
  862. else {
  863. this._targetBoundingCenter = null;
  864. }
  865. target.computeWorldMatrix();
  866. this._targetHost = target;
  867. this._target = this._getTargetPosition();
  868. this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);
  869. }
  870. else {
  871. const newTarget = target;
  872. const currentTarget = this._getTargetPosition();
  873. if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {
  874. return;
  875. }
  876. this._targetHost = null;
  877. this._target = newTarget;
  878. this._targetBoundingCenter = null;
  879. this.onMeshTargetChangedObservable.notifyObservers(null);
  880. }
  881. if (!cloneAlphaBetaRadius) {
  882. this.rebuildAnglesAndRadius();
  883. }
  884. }
  885. /** @internal */
  886. _getViewMatrix() {
  887. // Compute
  888. const cosa = Math.cos(this.alpha);
  889. const sina = Math.sin(this.alpha);
  890. const cosb = Math.cos(this.beta);
  891. let sinb = Math.sin(this.beta);
  892. if (sinb === 0) {
  893. sinb = 0.0001;
  894. }
  895. if (this.radius === 0) {
  896. this.radius = 0.0001; // Just to avoid division by zero
  897. }
  898. const target = this._getTargetPosition();
  899. this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
  900. // Rotate according to up vector
  901. if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {
  902. Vector3.TransformCoordinatesToRef(this._computationVector, this._yToUpMatrix, this._computationVector);
  903. }
  904. target.addToRef(this._computationVector, this._newPosition);
  905. if (this.getScene().collisionsEnabled && this.checkCollisions) {
  906. const coordinator = this.getScene().collisionCoordinator;
  907. if (!this._collider) {
  908. this._collider = coordinator.createCollider();
  909. }
  910. this._collider._radius = this.collisionRadius;
  911. this._newPosition.subtractToRef(this._position, this._collisionVelocity);
  912. this._collisionTriggered = true;
  913. coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
  914. }
  915. else {
  916. this._position.copyFrom(this._newPosition);
  917. let up = this.upVector;
  918. if (this.allowUpsideDown && sinb < 0) {
  919. up = up.negate();
  920. }
  921. this._computeViewMatrix(this._position, target, up);
  922. this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);
  923. this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);
  924. }
  925. this._currentTarget = target;
  926. return this._viewMatrix;
  927. }
  928. /**
  929. * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.
  930. * @param meshes Defines the mesh to zoom on
  931. * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)
  932. */
  933. zoomOn(meshes, doNotUpdateMaxZ = false) {
  934. meshes = meshes || this.getScene().meshes;
  935. const minMaxVector = Mesh.MinMax(meshes);
  936. let distance = this._calculateLowerRadiusFromModelBoundingSphere(minMaxVector.min, minMaxVector.max);
  937. // If there are defined limits, we need to take them into account
  938. distance = Math.max(Math.min(distance, this.upperRadiusLimit || Number.MAX_VALUE), this.lowerRadiusLimit || 0);
  939. this.radius = distance * this.zoomOnFactor;
  940. this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);
  941. }
  942. /**
  943. * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.
  944. * The target will be changed but the radius
  945. * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on
  946. * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)
  947. */
  948. focusOn(meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ = false) {
  949. let meshesOrMinMaxVector;
  950. let distance;
  951. if (meshesOrMinMaxVectorAndDistance.min === undefined) {
  952. // meshes
  953. const meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;
  954. meshesOrMinMaxVector = Mesh.MinMax(meshes);
  955. distance = Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);
  956. }
  957. else {
  958. //minMaxVector and distance
  959. const minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;
  960. meshesOrMinMaxVector = minMaxVectorAndDistance;
  961. distance = minMaxVectorAndDistance.distance;
  962. }
  963. this._target = Mesh.Center(meshesOrMinMaxVector);
  964. if (!doNotUpdateMaxZ) {
  965. this.maxZ = distance * 2;
  966. }
  967. }
  968. /**
  969. * @override
  970. * Override Camera.createRigCamera
  971. * @param name the name of the camera
  972. * @param cameraIndex the index of the camera in the rig cameras array
  973. */
  974. createRigCamera(name, cameraIndex) {
  975. let alphaShift = 0;
  976. switch (this.cameraRigMode) {
  977. case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
  978. case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
  979. case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
  980. case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:
  981. case Camera.RIG_MODE_VR:
  982. alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);
  983. break;
  984. case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
  985. alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);
  986. break;
  987. }
  988. const rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());
  989. rigCam._cameraRigParams = {};
  990. rigCam.isRigCamera = true;
  991. rigCam.rigParent = this;
  992. rigCam.upVector = this.upVector;
  993. rigCam.mode = this.mode;
  994. rigCam.orthoLeft = this.orthoLeft;
  995. rigCam.orthoRight = this.orthoRight;
  996. rigCam.orthoBottom = this.orthoBottom;
  997. rigCam.orthoTop = this.orthoTop;
  998. return rigCam;
  999. }
  1000. /**
  1001. * @internal
  1002. * @override
  1003. * Override Camera._updateRigCameras
  1004. */
  1005. _updateRigCameras() {
  1006. const camLeft = this._rigCameras[0];
  1007. const camRight = this._rigCameras[1];
  1008. camLeft.beta = camRight.beta = this.beta;
  1009. switch (this.cameraRigMode) {
  1010. case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
  1011. case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
  1012. case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
  1013. case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:
  1014. case Camera.RIG_MODE_VR:
  1015. camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
  1016. camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
  1017. break;
  1018. case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
  1019. camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
  1020. camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
  1021. break;
  1022. }
  1023. super._updateRigCameras();
  1024. }
  1025. /**
  1026. * @internal
  1027. */
  1028. _calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld, radiusScale = 1) {
  1029. const boxVectorGlobalDiagonal = Vector3.Distance(minimumWorld, maximumWorld);
  1030. // Get aspect ratio in order to calculate frustum slope
  1031. const engine = this.getScene().getEngine();
  1032. const aspectRatio = engine.getAspectRatio(this);
  1033. const frustumSlopeY = Math.tan(this.fov / 2);
  1034. const frustumSlopeX = frustumSlopeY * aspectRatio;
  1035. // Formula for setting distance
  1036. // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)
  1037. const radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;
  1038. // Horizon distance
  1039. const radius = radiusWithoutFraming * radiusScale;
  1040. const distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlopeX * frustumSlopeX));
  1041. const distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlopeY * frustumSlopeY));
  1042. return Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);
  1043. }
  1044. /**
  1045. * Destroy the camera and release the current resources hold by it.
  1046. */
  1047. dispose() {
  1048. this.inputs.clear();
  1049. super.dispose();
  1050. }
  1051. /**
  1052. * Gets the current object class name.
  1053. * @returns the class name
  1054. */
  1055. getClassName() {
  1056. return "ArcRotateCamera";
  1057. }
  1058. }
  1059. __decorate([
  1060. serialize()
  1061. ], ArcRotateCamera.prototype, "alpha", void 0);
  1062. __decorate([
  1063. serialize()
  1064. ], ArcRotateCamera.prototype, "beta", void 0);
  1065. __decorate([
  1066. serialize()
  1067. ], ArcRotateCamera.prototype, "radius", void 0);
  1068. __decorate([
  1069. serialize()
  1070. ], ArcRotateCamera.prototype, "overrideCloneAlphaBetaRadius", void 0);
  1071. __decorate([
  1072. serializeAsVector3("target")
  1073. ], ArcRotateCamera.prototype, "_target", void 0);
  1074. __decorate([
  1075. serializeAsMeshReference("targetHost")
  1076. ], ArcRotateCamera.prototype, "_targetHost", void 0);
  1077. __decorate([
  1078. serialize()
  1079. ], ArcRotateCamera.prototype, "inertialAlphaOffset", void 0);
  1080. __decorate([
  1081. serialize()
  1082. ], ArcRotateCamera.prototype, "inertialBetaOffset", void 0);
  1083. __decorate([
  1084. serialize()
  1085. ], ArcRotateCamera.prototype, "inertialRadiusOffset", void 0);
  1086. __decorate([
  1087. serialize()
  1088. ], ArcRotateCamera.prototype, "lowerAlphaLimit", void 0);
  1089. __decorate([
  1090. serialize()
  1091. ], ArcRotateCamera.prototype, "upperAlphaLimit", void 0);
  1092. __decorate([
  1093. serialize()
  1094. ], ArcRotateCamera.prototype, "lowerBetaLimit", void 0);
  1095. __decorate([
  1096. serialize()
  1097. ], ArcRotateCamera.prototype, "upperBetaLimit", void 0);
  1098. __decorate([
  1099. serialize()
  1100. ], ArcRotateCamera.prototype, "lowerRadiusLimit", void 0);
  1101. __decorate([
  1102. serialize()
  1103. ], ArcRotateCamera.prototype, "upperRadiusLimit", void 0);
  1104. __decorate([
  1105. serialize()
  1106. ], ArcRotateCamera.prototype, "inertialPanningX", void 0);
  1107. __decorate([
  1108. serialize()
  1109. ], ArcRotateCamera.prototype, "inertialPanningY", void 0);
  1110. __decorate([
  1111. serialize()
  1112. ], ArcRotateCamera.prototype, "pinchToPanMaxDistance", void 0);
  1113. __decorate([
  1114. serialize()
  1115. ], ArcRotateCamera.prototype, "panningDistanceLimit", void 0);
  1116. __decorate([
  1117. serializeAsVector3()
  1118. ], ArcRotateCamera.prototype, "panningOriginTarget", void 0);
  1119. __decorate([
  1120. serialize()
  1121. ], ArcRotateCamera.prototype, "panningInertia", void 0);
  1122. __decorate([
  1123. serialize()
  1124. ], ArcRotateCamera.prototype, "zoomToMouseLocation", null);
  1125. __decorate([
  1126. serialize()
  1127. ], ArcRotateCamera.prototype, "zoomOnFactor", void 0);
  1128. __decorate([
  1129. serializeAsVector2()
  1130. ], ArcRotateCamera.prototype, "targetScreenOffset", void 0);
  1131. __decorate([
  1132. serialize()
  1133. ], ArcRotateCamera.prototype, "allowUpsideDown", void 0);
  1134. __decorate([
  1135. serialize()
  1136. ], ArcRotateCamera.prototype, "useInputToRestoreState", void 0);
  1137. //# sourceMappingURL=arcRotateCamera.js.map