Add patch for XR Controller state instability, teleporting and turning dont need finger to be lifted
This commit is contained in:
parent
ec21a2f53f
commit
ef7ed70903
@ -155,8 +155,7 @@ public class ActionBasedControllerManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State transition actions
|
// State transition actions
|
||||||
[SerializeField]
|
[SerializeField] [Tooltip("The reference to the action of listening to teleport actions.")]
|
||||||
[Tooltip("The reference to the action of listening to teleport actions.")]
|
|
||||||
InputActionReference m_NagivationModifier;
|
InputActionReference m_NagivationModifier;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -541,11 +540,20 @@ public class ActionBasedControllerManager : MonoBehaviour
|
|||||||
var cancelTeleportModeAction = GetInputAction(m_TeleportModeCancel);
|
var cancelTeleportModeAction = GetInputAction(m_TeleportModeCancel);
|
||||||
var allowNavigationAction = GetInputAction(m_NagivationModifier);
|
var allowNavigationAction = GetInputAction(m_NagivationModifier);
|
||||||
|
|
||||||
|
|
||||||
var triggerTeleportMode = teleportModeAction != null && teleportModeAction.IsPressed();
|
var triggerTeleportMode = teleportModeAction != null && teleportModeAction.IsPressed();
|
||||||
var cancelTeleport = cancelTeleportModeAction != null && cancelTeleportModeAction.IsPressed();
|
var cancelTeleport = cancelTeleportModeAction != null && cancelTeleportModeAction.IsPressed();
|
||||||
var allowNavigation = allowNavigationAction != null && allowNavigationAction.IsPressed();
|
var allowNavigation = allowNavigationAction != null && allowNavigationAction.IsPressed();
|
||||||
|
|
||||||
if (triggerTeleportMode && !cancelTeleport && allowNavigation)
|
#region Check if teleport vector is north
|
||||||
|
|
||||||
|
Vector2 teleportAxis = teleportModeAction.ReadValue<Vector2>();
|
||||||
|
bool isNorth = teleportAxis.y > 0.8;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
if (triggerTeleportMode && !cancelTeleport && allowNavigation && isNorth)
|
||||||
{
|
{
|
||||||
TransitionState(m_SelectState, m_TeleportState);
|
TransitionState(m_SelectState, m_TeleportState);
|
||||||
return;
|
return;
|
||||||
@ -569,13 +577,23 @@ public class ActionBasedControllerManager : MonoBehaviour
|
|||||||
var cancelTeleportModeAction = GetInputAction(m_TeleportModeCancel);
|
var cancelTeleportModeAction = GetInputAction(m_TeleportModeCancel);
|
||||||
var allowNavigationAction = GetInputAction(m_NagivationModifier);
|
var allowNavigationAction = GetInputAction(m_NagivationModifier);
|
||||||
|
|
||||||
|
|
||||||
var cancelTeleport = cancelTeleportModeAction != null && cancelTeleportModeAction.triggered;
|
var cancelTeleport = cancelTeleportModeAction != null && cancelTeleportModeAction.triggered;
|
||||||
var releasedTeleport = teleportModeAction != null && teleportModeAction.phase == InputActionPhase.Waiting;
|
var releasedTeleport = teleportModeAction != null && teleportModeAction.phase == InputActionPhase.Waiting;
|
||||||
var allowNavigation = allowNavigationAction != null && allowNavigationAction.IsPressed();
|
var allowNavigation = allowNavigationAction != null && allowNavigationAction.IsPressed();
|
||||||
|
|
||||||
if (cancelTeleport || releasedTeleport)
|
|
||||||
|
if (cancelTeleport || releasedTeleport || !allowNavigation)
|
||||||
|
{
|
||||||
|
if (!cancelTeleport)
|
||||||
|
{
|
||||||
|
// Force teleportation
|
||||||
|
XRRayInteractor interactor = m_TeleportControllerGameObject.GetComponent<XRRayInteractor>();
|
||||||
|
if (interactor.selectTarget != null)
|
||||||
|
interactor.interactionManager.ForceSelect(interactor, interactor.selectTarget);
|
||||||
|
}
|
||||||
|
|
||||||
TransitionState(m_TeleportState, m_SelectState);
|
TransitionState(m_TeleportState, m_SelectState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnUpdateInteractState()
|
void OnUpdateInteractState()
|
||||||
|
@ -496,9 +496,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Teleport Mode Activate",
|
"name": "Teleport Mode Activate",
|
||||||
"type": "Button",
|
"type": "Value",
|
||||||
"id": "a6c7231d-c55d-4dd4-9e87-877bb5522ef5",
|
"id": "a6c7231d-c55d-4dd4-9e87-877bb5522ef5",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "Vector2",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": ""
|
"interactions": ""
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user