Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

OpenVR controller update #312

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ protected void UpdateButtonData(MixedRealityInteractionMapping interactionMappin
switch (interactionMapping.InputType)
{
case DeviceInputType.TriggerPress:
interactionMapping.BoolData = Input.GetAxis(interactionMapping.AxisCodeX).Equals(1);
interactionMapping.BoolData = Input.GetAxisRaw(interactionMapping.AxisCodeX).Equals(1);
break;
case DeviceInputType.TriggerNearTouch:
case DeviceInputType.ThumbNearTouch:
case DeviceInputType.IndexFingerNearTouch:
case DeviceInputType.MiddleFingerNearTouch:
case DeviceInputType.RingFingerNearTouch:
case DeviceInputType.PinkyFingerNearTouch:
interactionMapping.BoolData = !Input.GetAxis(interactionMapping.AxisCodeX).Equals(0);
interactionMapping.BoolData = !Input.GetAxisRaw(interactionMapping.AxisCodeX).Equals(0);
break;
default:
interactionMapping.BoolData = Input.GetKey(interactionMapping.KeyCode);
Expand All @@ -107,7 +107,7 @@ protected void UpdateButtonData(MixedRealityInteractionMapping interactionMappin
// If our value changed raise it.
if (interactionMapping.Changed)
{
// Raise input system Event if it enabled
// Raise input system Event if it is enabled
if (interactionMapping.BoolData)
{
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
Expand Down Expand Up @@ -136,22 +136,38 @@ protected void UpdateSingleAxisData(MixedRealityInteractionMapping interactionMa
{
Debug.Assert(interactionMapping.AxisType == AxisType.SingleAxis);

var singleAxisValue = Input.GetAxis(interactionMapping.AxisCodeX);
var singleAxisValue = Input.GetAxisRaw(interactionMapping.AxisCodeX);

// Update the interaction data source
interactionMapping.FloatData = singleAxisValue;

// If our value was updated, raise it.
if (interactionMapping.Updated)
if (interactionMapping.InputType == DeviceInputType.TriggerPress)
{
// Raise input system Event if it enabled
MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData);
}
// Update the interaction data source
interactionMapping.BoolData = singleAxisValue.Equals(1);

// If our value was updated, raise it.
if (interactionMapping.Updated)
// If our value changed raise it.
if (interactionMapping.Changed)
{
// Raise input system Event if it is enabled
if (interactionMapping.BoolData)
{
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
}
else
{
MixedRealityToolkit.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
}
}
}
else
{
MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, singleAxisValue);
// Update the interaction data source
interactionMapping.FloatData = singleAxisValue;

// If our value was updated, raise it.
if (interactionMapping.Updated)
{
// Raise input system Event if it is enabled
MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData);
}
}
}

Expand All @@ -172,7 +188,7 @@ protected void UpdateDualAxisData(MixedRealityInteractionMapping interactionMapp
// If our value was updated, raise it.
if (interactionMapping.Updated)
{
// Raise input system Event if it enabled
// Raise input system Event if it is enabled
MixedRealityToolkit.InputSystem?.RaisePositionInputChanged(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.Vector2Data);
}
}
Expand Down Expand Up @@ -207,7 +223,7 @@ protected void UpdatePoseData(MixedRealityInteractionMapping interactionMapping)
// If our value was updated, raise it.
if (interactionMapping.Updated)
{
// Raise input system Event if it enabled
// Raise input system Event if it is enabled
MixedRealityToolkit.InputSystem?.RaisePoseInputChanged(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.PoseData);
}
}
Expand Down