freeCameraGamepadInput.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import type { Nullable } from "../../types";
  2. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  3. import type { FreeCamera } from "../../Cameras/freeCamera";
  4. import { Gamepad } from "../../Gamepads/gamepad";
  5. /**
  6. * Manage the gamepad inputs to control a free camera.
  7. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  8. */
  9. export declare class FreeCameraGamepadInput implements ICameraInput<FreeCamera> {
  10. /**
  11. * Define the camera the input is attached to.
  12. */
  13. camera: FreeCamera;
  14. /**
  15. * Define the Gamepad controlling the input
  16. */
  17. gamepad: Nullable<Gamepad>;
  18. /**
  19. * Defines the gamepad rotation sensibility.
  20. * This is the threshold from when rotation starts to be accounted for to prevent jittering.
  21. */
  22. gamepadAngularSensibility: number;
  23. /**
  24. * Defines the gamepad move sensibility.
  25. * This is the threshold from when moving starts to be accounted for for to prevent jittering.
  26. */
  27. gamepadMoveSensibility: number;
  28. /**
  29. * Defines the minimum value at which any analog stick input is ignored.
  30. * Note: This value should only be a value between 0 and 1.
  31. */
  32. deadzoneDelta: number;
  33. private _yAxisScale;
  34. /**
  35. * Gets or sets a boolean indicating that Yaxis (for right stick) should be inverted
  36. */
  37. get invertYAxis(): boolean;
  38. set invertYAxis(value: boolean);
  39. private _onGamepadConnectedObserver;
  40. private _onGamepadDisconnectedObserver;
  41. private _cameraTransform;
  42. private _deltaTransform;
  43. private _vector3;
  44. private _vector2;
  45. /**
  46. * Attach the input controls to a specific dom element to get the input from.
  47. */
  48. attachControl(): void;
  49. /**
  50. * Detach the current controls from the specified dom element.
  51. */
  52. detachControl(): void;
  53. /**
  54. * Update the current camera state depending on the inputs that have been used this frame.
  55. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  56. */
  57. checkInputs(): void;
  58. /**
  59. * Gets the class name of the current input.
  60. * @returns the class name
  61. */
  62. getClassName(): string;
  63. /**
  64. * Get the friendly name associated with the input class.
  65. * @returns the input friendly name
  66. */
  67. getSimpleName(): string;
  68. }