Skip to content

Input Manager

bardsodal edited this page Dec 15, 2021 · 4 revisions

Introduction

Input Manager is one of the most important classes in BDK. It is responsible for handling all events related to input and manupulation of objects in the scene. This page outlines the most important events, actions and functions in InputManager.

Below is a description of the different ones.

ActionEvents

OnSourceFound

Is called when an input source is found.

OnSourceLost

Is called when an input source is lost.

OnInputUp

Is called when a hand stops pinching.

OnInputUpdated

Is called whenever a hand inside the tracking volume.

OnInputDown

Is called whenever a hand starts pinching.

OnManipulationStarted

Is called when a hand pinches down.

OnManipulationUpdated

Is called while a hand is pinching.

OnManipulationEnded

Is called when a hand stops pinching.

OnProximityStarted

Is called when a hand is in proximity of an object.

OnProximityUpdated

Is called while a hand is in proximity of an object.

OnProximityEnded

Is called when a hand leaves the proximity of an object.

OnPhraseRecognized

Is called when a phrase is recognized.

OnGazeEnter

Is called when the user looks at a new or different object than they looked at the previous frame.

OnGazeUpdate

Is called when the user is looking at something. i.e. the raycast from the eyes hit a collider.

OnGazeExit

Is called when the user stops looking at an object, blinks, closes their eyes, or tracking is lost in another way.

OnHololensTransformUpdated

Is called each frame with the updated position, rotation and forward vector of the Hololens gameobject.

OnHandRotationToggle

Is called each frame with the updated hand rotation.

Public functions

TryGetFocusedObject

TryGetFocusedObject tries to get a reference to the GameObject currently being focused on. This function will take into account the input priority of all the input sources and select the responding object. The object is returned as an out parameter. The function returns true if an object is being focused on, and false otherwise.

TryGetFocusedInteractable

TryGetFocusedInteractable tries to get a reference to the GameObject currently being focused on but only if it has an Interactible component. This function will take into account the input priority of all the input sources and select the responding object. The object is returned as an out parameter. The function returns true if an object is being focused on, and false otherwise.

TryGetFocusedButton

TryGetFocusedButton tries to get a reference to the GameObject currently being focused on but only if it has an InteractibleButton component. This function will take into account the input priority of all the input sources and select the responding object. The object is returned as an out parameter. The function returns true if an object is being focused on, and false otherwise.

TryGetCursorPosition

Returns the main cursor position. (based on input priority)

TryGetCursorRotation

Returns the main cursor rotation. (based on input priority)

TryGetActiveCursorTransform

Returns the transform of the main cursor. (based on input priority)

TryGetCursorTransform

Returns the transform of any cursor you want as long as it exists.

TryGetMainActiveInputSource

TryGetMainActiveInputSource returns the main input source as an out parameter. The function returns true if an input source is found, and false otherwise.

TryGetInputSource

TryGetInputSource tries to get a specific input source from the list of input sources. This is returned as an out parameter. The function returns true if an input source is found, and false otherwise.

AddPhraseForVoiceRecognizion

AddPhraseForVoiceRecognizion tries to add a new phrase and action to the voice recognition functionality.

TryGetHandJointTransform

TryGetHandJointTransform tries to get a specific joint transform from a specified hand. The position and rotation are returned as out parameters. The function returns true if a joint is found, and false otherwise.

TryGetDistanceBetweenJoints

TryGetDistanceBetweenJoints tries to get the distance between a joint on the left and a joint on the right hand (the same joint type). The distance is returned as out parameters. The function returns true if a joint is found, and false otherwise.