Last active
March 11, 2019 19:05
-
-
Save StephenHodgson/85b591657fd2d2a574501e6a96c39a99 to your computer and use it in GitHub Desktop.
Example script for Getting to know the new XRTK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InputTest : BaseInputHandler, IMixedRealitySpatialInputHandler | |
{ | |
[SerializeField] | |
private MixedRealityInputAction myAction = MixedRealityInputAction.None; // <-- Set in the inspector. | |
public void OnInputUp(InputEventData eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnInputUp {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description}"); | |
} | |
} | |
public void OnInputDown(InputEventData eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnInputDown {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description}"); | |
} | |
} | |
public void OnInputPressed(InputEventData<float> eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnInputPressed {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description} | {eventData.InputData}"); | |
} | |
} | |
public void OnPositionInputChanged(InputEventData<Vector2> eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnPositionInputChanged {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description} | {eventData.InputData}"); | |
} | |
} | |
public void OnPositionChanged(InputEventData<Vector3> eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnPositionChanged {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description} | {eventData.InputData}"); | |
} | |
} | |
public void OnRotationChanged(InputEventData<Quaternion> eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnRotationChanged {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description} | {eventData.InputData}"); | |
} | |
} | |
public void OnPoseInputChanged(InputEventData<MixedRealityPose> eventData) | |
{ | |
if (eventData.MixedRealityInputAction == myAction) | |
{ | |
Debug.Log($"OnPoseInputChanged {eventData.InputSource.SourceName} | {eventData.MixedRealityInputAction.Description} | {eventData.InputData}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment