babylon.deviceOrientationCamera.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var BABYLON;
  7. (function (BABYLON) {
  8. // We're mainly based on the logic defined into the FreeCamera code
  9. var DeviceOrientationCamera = (function (_super) {
  10. __extends(DeviceOrientationCamera, _super);
  11. //-- end properties for backward compatibility for inputs
  12. function DeviceOrientationCamera(name, position, scene) {
  13. _super.call(this, name, position, scene);
  14. this.inputs.addDeviceOrientation();
  15. }
  16. Object.defineProperty(DeviceOrientationCamera.prototype, "angularSensibility", {
  17. //-- Begin properties for backward compatibility for inputs
  18. get: function () {
  19. var gamepad = this.inputs.attached["deviceOrientation"];
  20. if (gamepad)
  21. return gamepad.angularSensibility;
  22. },
  23. set: function (value) {
  24. var gamepad = this.inputs.attached["deviceOrientation"];
  25. if (gamepad)
  26. gamepad.angularSensibility = value;
  27. },
  28. enumerable: true,
  29. configurable: true
  30. });
  31. Object.defineProperty(DeviceOrientationCamera.prototype, "moveSensibility", {
  32. get: function () {
  33. var gamepad = this.inputs.attached["deviceOrientation"];
  34. if (gamepad)
  35. return gamepad.moveSensibility;
  36. },
  37. set: function (value) {
  38. var gamepad = this.inputs.attached["deviceOrientation"];
  39. if (gamepad)
  40. gamepad.moveSensibility = value;
  41. },
  42. enumerable: true,
  43. configurable: true
  44. });
  45. DeviceOrientationCamera.prototype.getTypeName = function () {
  46. return "DeviceOrientationCamera";
  47. };
  48. return DeviceOrientationCamera;
  49. })(BABYLON.FreeCamera);
  50. BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
  51. })(BABYLON || (BABYLON = {}));