Class FlyCameraInputsManager
Hierarchy (View Summary)
- CameraInputsManager<FlyCamera>
- FlyCameraInputsManager
Constructors
constructor
-
Instantiates a new FlyCameraInputsManager.
Parameters
- camera: FlyCamera
Defines the camera the inputs belong to.
Returns FlyCameraInputsManager
- camera: FlyCamera
Properties
attached
Defines the list of inputs attached to the camera.
attached To Element
Defines the dom element the camera is collecting inputs from. This is null if the controls have not been attached.
camera
Defined the camera the input manager belongs to.
check Inputs
Update the current camera state depending on the inputs that have been used this frame. This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
no Prevent Default
Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
Methods
add
-
Add an input method to a camera
Parameters
- input: ICameraInput<FlyCamera>
Camera input method
Returns void
- input: ICameraInput<FlyCamera>
add Keyboard
-
Add keyboard input support to the input manager.
Returns FlyCameraInputsManager
the new FlyCameraKeyboardMoveInput().
add Mouse
-
Add mouse input support to the input manager.
Returns FlyCameraInputsManager
the new FlyCameraMouseInput().
attach Element
-
Attach the current manager inputs controls to a specific dom element to listen the events from.
Parameters
- noPreventDefault: boolean = false
Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
Returns void
- noPreventDefault: boolean = false
attach Input
-
Attach the input controls to the currently attached dom element to listen the events from.
Parameters
- input: ICameraInput<FlyCamera>
Defines the input to attach
Returns void
- input: ICameraInput<FlyCamera>
clear
-
Remove all attached input methods from a camera
Returns void
detach Element
-
Detach the current manager inputs controls from a specific dom element.
Parameters
- disconnect: boolean = false
Defines whether the input should be removed from the current list of attached inputs
Returns void
- disconnect: boolean = false
parse
-
Parses an input manager serialized JSON to restore the previous list of inputs and states associated to a camera.
Parameters
- parsedCamera: any
Defines the JSON to parse
Returns void
- parsedCamera: any
rebuild Input Check
-
Rebuild the dynamic inputCheck function from the current list of defined inputs in the manager.
Returns void
remove
-
Remove a specific input method from a camera example: camera.inputs.remove(camera.inputs.attached.mouse);
Parameters
- inputToRemove: ICameraInput<FlyCamera>
camera input method
Returns void
- inputToRemove: ICameraInput<FlyCamera>
remove By Type
-
Remove a specific input type from a camera example: camera.inputs.remove("ArcRotateCameraGamepadInput");
Parameters
- inputType: string
the type of the input to remove
Returns void
- inputType: string
serialize
-
Serialize the current input manager attached to a camera. This ensures than once parsed, the input associated to the camera will be identical to the current ones
Parameters
- serializedCamera: any
Defines the camera serialization JSON the input serialization should write to
Returns void
- serializedCamera: any
Default Inputs manager for the FlyCamera. It groups all the default supported inputs for ease of use.
See
https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs