Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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 @@ -49,7 +49,7 @@ MonoBehaviour:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
m_Reference: {fileID: -6131295136447488360, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
m_Reference: {fileID: -294446728694031702, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
rightHandPosition:
m_UseReference: 1
m_Action:
Expand Down Expand Up @@ -85,4 +85,4 @@ MonoBehaviour:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
m_Reference: {fileID: 187161793506945269, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
m_Reference: {fileID: 2995356199736570127, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ MonoBehaviour:
m_AutoDeselect: 0
m_TimeToAutoDeselect: 3
m_EnableUIInteraction: 1
m_BlockInteractionsWithScreenSpaceUI: 0
m_BlockUIOnInteractableSelection: 1
m_ManipulateAttachTransform: 0
m_UseForceGrab: 0
Expand Down Expand Up @@ -690,6 +691,76 @@ Transform:
m_Children: []
m_Father: {fileID: 1948193616346090106}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &317859718934353354
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4926630461381577642}
- component: {fileID: 2393634401634928266}
m_Layer: 0
m_Name: PinchInputReader
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4926630461381577642
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 317859718934353354}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2497193556380645624}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2393634401634928266
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 317859718934353354}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 63844496262f1724ba77344d77fbf000, type: 3}
m_Name:
m_EditorClassIdentifier:
handNode: 4
selectAction:
m_UseReference: 1
m_Action:
m_Name: Select
m_Type: 1
m_ExpectedControlType:
m_Id: ff1c01c3-260e-48d6-8691-2b8a494333a9
m_Processors:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
m_Reference: {fileID: 4911936264890632658, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
selectActionValue:
m_UseReference: 1
m_Action:
m_Name: Select Value
m_Type: 0
m_ExpectedControlType: Axis
m_Id: 98e439e1-c087-42a6-bf66-ebe8e973e5bf
m_Processors:
m_Interactions:
m_SingletonActionBindings: []
m_Flags: 0
m_Reference: {fileID: -4241056287068600476, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
trackedPoseDriver: {fileID: 3281803018082669919}
--- !u!1 &761938320343190485
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -782,7 +853,7 @@ MonoBehaviour:
m_Flags: 0
m_InputActionReferencePerformed: {fileID: -6131295136447488360, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
m_InputActionReferenceValue: {fileID: -294446728694031702, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
m_ObjectReferenceObject: {fileID: 5536072158143193164}
m_ObjectReferenceObject: {fileID: 2393634401634928266}
m_ManualPerformed: 0
m_ManualValue: 0
m_ManualQueuePerformed: 0
Expand Down Expand Up @@ -2014,6 +2085,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1980541278490804707}
- {fileID: 4926630461381577642}
- {fileID: 6709287148685916850}
m_Father: {fileID: 1948193615953854875}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1948193615953854874, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
Expand Down Expand Up @@ -87,42 +88,18 @@ PrefabInstance:
propertyPath: managedReferences[2].trackingStateActionProperty.m_Reference
value:
objectReference: {fileID: 3239510804178183174, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_Handedness
value: 2
- target: {fileID: 2393634401634928266, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: handNode
value: 5
objectReference: {fileID: 0}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_SelectInput.m_InputActionReferenceValue
value:
objectReference: {fileID: 3279264004350380116, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_UIPressInput.m_InputActionReferenceValue
value:
objectReference: {fileID: 3279264004350380116, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_ActivateInput.m_InputActionReferenceValue
value:
objectReference: {fileID: 83097790271614945, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_SelectInput.m_InputActionReferencePerformed
value:
objectReference: {fileID: 3279264004350380116, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_UIPressInput.m_InputActionReferencePerformed
value:
objectReference: {fileID: 3279264004350380116, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_ActivateInput.m_InputActionReferencePerformed
value:
objectReference: {fileID: 83097790271614945, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_RotateManipulationInput.m_InputActionReference
- target: {fileID: 2393634401634928266, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: selectAction.m_Reference
value:
objectReference: {fileID: -5913262927076077117, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2493754451733599906, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_TranslateManipulationInput.m_InputActionReference
objectReference: {fileID: -7447404843880048209, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2393634401634928266, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: selectActionValue.m_Reference
value:
objectReference: {fileID: 875253871413052681, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
objectReference: {fileID: -5185190146762457406, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 2572330550550829917, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_Handedness
value: 2
Expand Down Expand Up @@ -307,14 +284,6 @@ PrefabInstance:
propertyPath: selectActionValue.m_Reference
value:
objectReference: {fileID: 2995356199736570127, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 5536072158143193164, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: trackingStateInput.m_Reference
value:
objectReference: {fileID: 3239510804178183174, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 6164080946324827545, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: handNode
value: 5
objectReference: {fileID: 0}
- target: {fileID: 6937621743165281871, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: settings.handedness
value: 2
Expand All @@ -339,21 +308,8 @@ PrefabInstance:
propertyPath: selectActionValue.m_Reference
value:
objectReference: {fileID: 3279264004350380116, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 8876097134604027714, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: trackingStateInput.m_Reference
value:
objectReference: {fileID: 3239510804178183174, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 9028998875765828509, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_PositionInput.m_Reference
value:
objectReference: {fileID: -1813146318149588949, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 9028998875765828509, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_RotationInput.m_Reference
value:
objectReference: {fileID: 5820880757197039143, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
- target: {fileID: 9028998875765828509, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
propertyPath: m_TrackingStateInput.m_Reference
value:
objectReference: {fileID: 3239510804178183174, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 90f955d6c9d709448a0b1e29e1f9c046, type: 3}
1 change: 1 addition & 0 deletions org.mixedrealitytoolkit.input/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed

* Updated the minimum editor version to 2022.3.6f1 [PR #1003](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1003)
* Split out mappings for "airtap" and "grab", as well as mapping other bespoke interaction profile actions (like those provided by the Hand Interaction Profile). [PR #1040](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1040)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,8 @@ protected override void UpdateInput(XRControllerState controllerState)
// If we still don't have an aggregator, then don't update selects.
if (XRSubsystemHelpers.HandsAggregator == null) { return; }

bool gotPinchData = XRSubsystemHelpers.HandsAggregator.TryGetPinchProgress(
handNode,
out bool isPinchReady,
out bool isPinching,
out float pinchAmount
);

// If we got pinch data, write it into our select interaction state.
if (gotPinchData)
if (XRSubsystemHelpers.HandsAggregator.TryGetPinchProgress(handNode, out bool isPinchReady, out _, out float pinchAmount))
{
// Workaround for missing select actions on devices without interaction profiles
// for hands, such as Varjo and Quest. Should be removed once we have universal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct MRTKSimulatedControllerState : IInputStateTypeInfo
/// <summary>
/// Represents the user's grip on the controller.
/// </summary>
[InputControl(usage = "Grip", layout = "Axis")]
[InputControl(usage = "Grip", alias = "squeeze", layout = "Axis")]
[FieldOffset(12)]
public float grip;

Expand All @@ -60,7 +60,7 @@ public struct MRTKSimulatedControllerState : IInputStateTypeInfo
[InputControl(name = nameof(XRSimulatedController.primaryTouch), usage = "PrimaryTouch", layout = "Button", bit = (uint)ControllerButton.PrimaryTouch)]
[InputControl(name = nameof(XRSimulatedController.secondaryButton), usage = "SecondaryButton", layout = "Button", bit = (uint)ControllerButton.SecondaryButton)]
[InputControl(name = nameof(XRSimulatedController.secondaryTouch), usage = "SecondaryTouch", layout = "Button", bit = (uint)ControllerButton.SecondaryTouch)]
[InputControl(name = nameof(XRSimulatedController.gripButton), usage = "GripButton", layout = "Button", bit = (uint)ControllerButton.GripButton, alias = "gripPressed")]
[InputControl(name = nameof(XRSimulatedController.gripButton), usage = "GripButton", layout = "Button", bit = (uint)ControllerButton.GripButton, aliases = new[] { "gripPressed", "squeezeClicked" })]
[InputControl(name = nameof(XRSimulatedController.triggerButton), usage = "TriggerButton", layout = "Button", bit = (uint)ControllerButton.TriggerButton, alias = "triggerPressed")]
[InputControl(name = nameof(XRSimulatedController.menuButton), usage = "MenuButton", layout = "Button", bit = (uint)ControllerButton.MenuButton)]
[InputControl(name = nameof(XRSimulatedController.primary2DAxisClick), usage = "Primary2DAxisClick", layout = "Button", bit = (uint)ControllerButton.Primary2DAxisClick)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,7 @@ private void ApplyState(ControllerControls controls)
// simulatedControllerState.primary2DAxis = controls.Primary2DAxis;
// simulatedControllerState.secondary2DAxis = controls.Secondary2DAxis;

// Note: if trigger button is activated, the joint synthesizer will instantly pinch, without smoothing.
// If smoothed pinch is desired, use controls.TriggerAxis.
simulatedControllerState.WithButton(ControllerButton.TriggerButton, controls.TriggerButton);

simulatedControllerState.WithButton(ControllerButton.GripButton, controls.GripButton);

// todo: "soon"
Expand Down
14 changes: 1 addition & 13 deletions org.mixedrealitytoolkit.input/Simulation/InputSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,6 @@ public ControllerSimulationSettings RightControllerSettings
set => rightControllerSettings = value;
}

// Should we pass the trigger button straight through to the device?
// This will not smooth the trigger press; typically, we should
// modulate the trigger axis control ourselves for smooth pinch/unpinch.
private bool shouldUseTriggerButton = false;

// TODO: Drive from inspector/simulator options.
private float triggerSmoothTime = 0.1f;

Expand Down Expand Up @@ -556,14 +551,7 @@ private void UpdateSimulatedController(Handedness handedness)
#endif // LATER

// Buttons available to hands and controllers
// Should we pass the trigger button straight through to the device?
// This will not smooth the trigger press; typically, we should
// modulate the trigger axis control ourselves for smooth pinch/unpinch,
// and this is false.
if (shouldUseTriggerButton)
{
controls.TriggerButton = ctrlSettings.TriggerButton.action.IsPressed();
}
controls.TriggerButton = controls.TriggerAxis >= InputSystem.settings.defaultButtonPressPoint;
controls.GripButton = ctrlSettings.GripButton.action.IsPressed();

if (ctrlSettings.SimulationMode == ControllerSimulationMode.MotionController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace MixedReality.Toolkit.Input.Tests
{
public class InputTestUtilities
public static class InputTestUtilities
{
private const string MRTKRigPrefabGuid = "4d7e2f87fefe0ba468719b15288b46e7";
private static readonly string MRTKRigPrefabPath = AssetDatabase.GUIDToAssetPath(MRTKRigPrefabGuid);
Expand Down Expand Up @@ -59,7 +59,7 @@ public class InputTestUtilities
/// to ensure that tests will run quickly in general, and can be set to true manually in specific
/// test cases using the example below.
/// </summary>
/// <example>
/// <example>
/// <code>
/// [UnityTest]
/// public IEnumerator YourTestCase()
Expand Down Expand Up @@ -221,7 +221,7 @@ public static void TeardownRig()
/// </summary>
/// <remarks>
/// This will create two <see cref="SimulatedController"/> object, a <see cref="SimulatedHMD"/>
/// object, and the associated <see cref="ControllerControls"/> objects.
/// object, and the associated <see cref="ControllerControls"/> objects.
/// </remarks>
/// <param name="rayHalfLife">
/// Optional value for ray smoothing halflife, handy for suppressing smoothing during automated tests.
Expand Down Expand Up @@ -300,7 +300,7 @@ public static IEnumerator SetHandTrackingState(Handedness handedness, bool isTra
/// </summary>
/// <remarks>
/// <para>
/// This moves the hand from <paramref name="startPosition"/> to <paramref name="endPosition"/>, rotates the hand from
/// This moves the hand from <paramref name="startPosition"/> to <paramref name="endPosition"/>, rotates the hand from
/// <paramref name="startRotation"/> to <paramref name="endRotation"/>, and smooths the handshape
/// based on the provided <paramref name="handshapeId"/> over the number of steps provided by <paramref name="numSteps"/>.
/// </para>
Expand Down Expand Up @@ -411,7 +411,7 @@ public static IEnumerator RotateHand(
/// </summary>
/// <remarks>
/// <para>
/// This rotates the hand to <paramref name="newRotation"/>, and smooths the handshape based on the provided
/// This rotates the hand to <paramref name="newRotation"/>, and smooths the handshape based on the provided
/// <paramref name="handshapeId"/> over the number of steps provided by <paramref name="numSteps"/>.
/// </para>
/// <para>
Expand Down Expand Up @@ -453,7 +453,7 @@ public static IEnumerator PointHandToTarget(Vector3 target, HandshapeId handshap
/// </summary>
/// <remarks>
/// <para>
/// This smooths the handshape based on the provided/ <paramref name="handshapeId"/> over the number of
/// This smooths the handshape based on the provided/ <paramref name="handshapeId"/> over the number of
/// steps provided by <paramref name="numSteps"/>.
/// </para>
/// <para>
Expand Down Expand Up @@ -711,7 +711,7 @@ public enum RigVersion
/// Force the use of a rig that does not use the deprecated XRI controller components, but still utilizes
/// all the custom MRTK interactors.
/// </summary>
Version2 = 2,
Version2 = 2,
}

/// <summary>
Expand Down Expand Up @@ -831,6 +831,7 @@ public bool Update()
);
float pinchAmount = Mathf.Lerp(startingPinchAmount, isPinching ? 1 : 0, t);

request.controls.TriggerButton = pinchAmount >= InputSystem.settings.defaultButtonPressPoint;
request.controls.TriggerAxis = pinchAmount;
switch (request.anchorPoint)
{
Expand Down