flyCameraKeyboardInput.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  2. import type { FlyCamera } from "../../Cameras/flyCamera";
  3. /**
  4. * Listen to keyboard events to control the camera.
  5. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  6. */
  7. export declare class FlyCameraKeyboardInput implements ICameraInput<FlyCamera> {
  8. /**
  9. * Defines the camera the input is attached to.
  10. */
  11. camera: FlyCamera;
  12. /**
  13. * The list of keyboard keys used to control the forward move of the camera.
  14. */
  15. keysForward: number[];
  16. /**
  17. * The list of keyboard keys used to control the backward move of the camera.
  18. */
  19. keysBackward: number[];
  20. /**
  21. * The list of keyboard keys used to control the forward move of the camera.
  22. */
  23. keysUp: number[];
  24. /**
  25. * The list of keyboard keys used to control the backward move of the camera.
  26. */
  27. keysDown: number[];
  28. /**
  29. * The list of keyboard keys used to control the right strafe move of the camera.
  30. */
  31. keysRight: number[];
  32. /**
  33. * The list of keyboard keys used to control the left strafe move of the camera.
  34. */
  35. keysLeft: number[];
  36. private _keys;
  37. private _onCanvasBlurObserver;
  38. private _onKeyboardObserver;
  39. private _engine;
  40. private _scene;
  41. /**
  42. * Attach the input controls to a specific dom element to get the input from.
  43. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  44. */
  45. attachControl(noPreventDefault?: boolean): void;
  46. /**
  47. * Detach the current controls from the specified dom element.
  48. */
  49. detachControl(): void;
  50. /**
  51. * Gets the class name of the current input.
  52. * @returns the class name
  53. */
  54. getClassName(): string;
  55. /**
  56. * @internal
  57. */
  58. _onLostFocus(): void;
  59. /**
  60. * Get the friendly name associated with the input class.
  61. * @returns the input friendly name
  62. */
  63. getSimpleName(): string;
  64. /**
  65. * Update the current camera state depending on the inputs that have been used this frame.
  66. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  67. */
  68. checkInputs(): void;
  69. }