babylon.freeCameraInputsManager.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. module BABYLON {
  2. /**
  3. * Default Inputs manager for the FreeCamera.
  4. * It groups all the default supported inputs for ease of use.
  5. * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
  6. */
  7. export class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
  8. /**
  9. * Instantiates a new FreeCameraInputsManager.
  10. * @param camera Defines the camera the inputs belong to
  11. */
  12. constructor(camera: FreeCamera) {
  13. super(camera);
  14. }
  15. /**
  16. * Add keyboard input support to the input manager.
  17. * @returns the current input manager
  18. */
  19. addKeyboard(): FreeCameraInputsManager {
  20. this.add(new FreeCameraKeyboardMoveInput());
  21. return this;
  22. }
  23. /**
  24. * Add mouse input support to the input manager.
  25. * @returns the current input manager
  26. */
  27. addMouse(touchEnabled = true): FreeCameraInputsManager {
  28. this.add(new FreeCameraMouseInput(touchEnabled));
  29. return this;
  30. }
  31. /**
  32. * Add orientation input support to the input manager.
  33. * @returns the current input manager
  34. */
  35. addDeviceOrientation(): FreeCameraInputsManager {
  36. this.add(new FreeCameraDeviceOrientationInput());
  37. return this;
  38. }
  39. /**
  40. * Add touch input support to the input manager.
  41. * @returns the current input manager
  42. */
  43. addTouch(): FreeCameraInputsManager {
  44. this.add(new FreeCameraTouchInput());
  45. return this;
  46. }
  47. /**
  48. * Add virtual joystick input support to the input manager.
  49. * @returns the current input manager
  50. */
  51. addVirtualJoystick(): FreeCameraInputsManager {
  52. this.add(new FreeCameraVirtualJoystickInput());
  53. return this;
  54. }
  55. }
  56. }