Skip to content

Commit d228c94

Browse files
authored
Merge pull request #20 from ExtendRealityLtd/fix/axis-deadzones
fix(Samples): ensure axis values are always broadcast - fixes #19
2 parents 51bf037 + 0a30d6d commit d228c94

5 files changed

Lines changed: 20 additions & 28 deletions

File tree

Runtime/SharedResources/Scripts/Transformation/Conversion/CallbackContextToFloat.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,14 @@ public class CallbackContextToFloat : CallbackContextTransformer<float, Callback
1717
[Serializable]
1818
public class UnityEvent : UnityEvent<float> { }
1919

20-
/// <summary>
21-
/// The minimum value to consider as a zero float value.
22-
/// </summary>
23-
[Serialized]
24-
[field: DocumentedByXml]
25-
public float DeadZoneValue { get; set; } = 0.00001f;
26-
2720
/// <summary>
2821
/// Transforms the given input <see cref="InputAction.CallbackContext"/> to the equivalent <see cref="float"/> value.
2922
/// </summary>
3023
/// <param name="input">The value to transform.</param>
3124
/// <returns>The transformed value.</returns>
3225
protected override float Process(InputAction.CallbackContext input)
3326
{
34-
float value = input.ReadValue<float>();
35-
return value >= DeadZoneValue ? value : 0f;
27+
return input.ReadValue<float>();
3628
}
3729
}
3830
}

Samples~/GenericXR/InputActions_GenericXR.inputactions

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "GenericXR",
2+
"name": "InputActions_GenericXR",
33
"maps": [
44
{
55
"name": "Generic XR",
@@ -427,7 +427,7 @@
427427
"id": "d4053378-e958-4c21-9f4a-5af419e3ddf6",
428428
"path": "<XRController>{LeftHand}/touchpad",
429429
"interactions": "",
430-
"processors": "",
430+
"processors": "StickDeadzone",
431431
"groups": "",
432432
"action": "Left Touchpad Axis",
433433
"isComposite": false,
@@ -438,7 +438,7 @@
438438
"id": "19ba18e3-f598-4876-bff4-df835ed03025",
439439
"path": "<XRController>{LeftHand}/trigger",
440440
"interactions": "",
441-
"processors": "",
441+
"processors": "AxisDeadzone",
442442
"groups": "",
443443
"action": "Left Trigger Axis",
444444
"isComposite": false,
@@ -449,7 +449,7 @@
449449
"id": "05c2ede1-7d58-4869-9d81-86f9a3a90082",
450450
"path": "<XRController>{LeftHand}/grip",
451451
"interactions": "",
452-
"processors": "",
452+
"processors": "AxisDeadzone",
453453
"groups": "",
454454
"action": "Left Grip Axis",
455455
"isComposite": false,
@@ -460,7 +460,7 @@
460460
"id": "e19ced91-8a03-4f38-9103-c42dbdc339a2",
461461
"path": "<XRController>{LeftHand}/thumbstick",
462462
"interactions": "",
463-
"processors": "",
463+
"processors": "StickDeadzone",
464464
"groups": "",
465465
"action": "Left Thumbstick Axis",
466466
"isComposite": false,
@@ -614,7 +614,7 @@
614614
"id": "cff083a6-3f01-4789-a7ac-fbac350351dc",
615615
"path": "<XRController>{RightHand}/touchpad",
616616
"interactions": "",
617-
"processors": "",
617+
"processors": "StickDeadzone",
618618
"groups": "",
619619
"action": "Right Touchpad Axis",
620620
"isComposite": false,
@@ -625,7 +625,7 @@
625625
"id": "be2f2769-695f-456f-9e26-bd7adcf25d32",
626626
"path": "<XRController>{RightHand}/trigger",
627627
"interactions": "",
628-
"processors": "",
628+
"processors": "AxisDeadzone",
629629
"groups": "",
630630
"action": "Right Trigger Axis",
631631
"isComposite": false,
@@ -636,7 +636,7 @@
636636
"id": "c853ce6d-0bcf-419c-8351-842999c0de0a",
637637
"path": "<XRController>{RightHand}/grip",
638638
"interactions": "",
639-
"processors": "",
639+
"processors": "AxisDeadzone",
640640
"groups": "",
641641
"action": "Right Grip Axis",
642642
"isComposite": false,
@@ -647,7 +647,7 @@
647647
"id": "88f02c68-5491-474e-90c4-306171ab6def",
648648
"path": "<XRController>{RightHand}/thumbstick",
649649
"interactions": "",
650-
"processors": "",
650+
"processors": "StickDeadzone",
651651
"groups": "",
652652
"action": "Right Thumbstick Axis",
653653
"isComposite": false,

Samples~/GenericXR/InputActions_GenericXR.inputactions.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Samples~/GenericXR/UnityInputSystem.Mappings.GenericXR.prefab

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ MonoBehaviour:
515515
m_StringArgument:
516516
m_BoolArgument: 0
517517
m_CallState: 2
518-
contextToProcess: 2
518+
contextToProcess: -1
519519
--- !u!1 &6349443294227618252
520520
GameObject:
521521
m_ObjectHideFlags: 0
@@ -1964,7 +1964,7 @@ MonoBehaviour:
19641964
m_StringArgument:
19651965
m_BoolArgument: 0
19661966
m_CallState: 2
1967-
contextToProcess: 2
1967+
contextToProcess: -1
19681968
--- !u!1 &6349443294806420875
19691969
GameObject:
19701970
m_ObjectHideFlags: 0
@@ -2797,7 +2797,7 @@ MonoBehaviour:
27972797
m_StringArgument:
27982798
m_BoolArgument: 0
27992799
m_CallState: 2
2800-
contextToProcess: 2
2800+
contextToProcess: -1
28012801
--- !u!1 &6349443295184921974
28022802
GameObject:
28032803
m_ObjectHideFlags: 0
@@ -2917,7 +2917,7 @@ MonoBehaviour:
29172917
m_StringArgument:
29182918
m_BoolArgument: 0
29192919
m_CallState: 2
2920-
contextToProcess: 2
2920+
contextToProcess: -1
29212921
--- !u!1 &6349443295214854025
29222922
GameObject:
29232923
m_ObjectHideFlags: 0
@@ -3037,7 +3037,7 @@ MonoBehaviour:
30373037
m_StringArgument:
30383038
m_BoolArgument: 0
30393039
m_CallState: 2
3040-
contextToProcess: 2
3040+
contextToProcess: -1
30413041
--- !u!1 &6349443295252543439
30423042
GameObject:
30433043
m_ObjectHideFlags: 0
@@ -4501,7 +4501,7 @@ MonoBehaviour:
45014501
m_StringArgument:
45024502
m_BoolArgument: 0
45034503
m_CallState: 2
4504-
contextToProcess: 2
4504+
contextToProcess: -1
45054505
--- !u!1 &6349443295763352110
45064506
GameObject:
45074507
m_ObjectHideFlags: 0
@@ -4695,7 +4695,7 @@ MonoBehaviour:
46954695
m_StringArgument:
46964696
m_BoolArgument: 0
46974697
m_CallState: 2
4698-
contextToProcess: 2
4698+
contextToProcess: -1
46994699
--- !u!1 &6349443295896242458
47004700
GameObject:
47014701
m_ObjectHideFlags: 0
@@ -5335,4 +5335,4 @@ MonoBehaviour:
53355335
m_StringArgument:
53365336
m_BoolArgument: 0
53375337
m_CallState: 2
5338-
contextToProcess: 2
5338+
contextToProcess: -1

Samples~/GenericXR/UnityInputSystem.Mappings.GenericXR.prefab.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)