Skip to content

Commit 4cd52a8

Browse files
author
Unity Technologies
committed
com.unity.xr.interaction.toolkit@2.3.1
## [2.3.1] - 2023-03-27 ### Added - Added System Gesture Detector component to the Hands Interaction Demo sample to add system gesture and menu palm pinch gesture events. Added sound upon menu press as an example. Added Aim Flags input actions to the `XRI Default Input Actions` in the Starter Assets sample to support this. - Added [Interaction filters](../manual/interaction-filters.md) documentation for `IXRHoverFilter`, `IXRSelectFilter`, `IXRInteractionStrengthFilter`, and the corresponding filter delegates with examples. ### Changed - Changed the Poke Gesture Detector component in the Hands Interaction Demo sample to no longer end the poke gesture when hand tracking is lost. This fixes the Ray Interactor line visual reappearing when hand tracking is lost while doing the poke gesture. - Changed `XRInteractorReticleVisual` to ensure consistent attempts to align the reticle prefab's `z` axis with the `transform.up` of the XROrigin when `AlignPrefabWithSurfaceNormal` is `true` and aligning with a non-horizontal surface. - Changed `XRInteractorReticleVisual` to align the reticle prefab's `z` axis with the forward direction of the reticle's interactor when `AlignPrefabWithSurfaceNormal` is `true` and aligning with a horizontal surface. - Updated installation documentation with convenience links for installing the XRI package on older versions of Unity 2021 where the package was not included in the main Editor manifest. - Changed so UGUI poke interactions are now considered to be blocking interactions for interaction groups. This allows rays to be properly hidden when hovering or selecting a UGUI canvas with poke. - Changed to use velocity estimation of poke interactor to add an extra validation mechanism in the XR Poke Filter hover validation check to allow poke selection to occur in cases where it was previously rejected, while still preventing poking from behind and other non-desireable cases. - Changed to cache poke selection validation check so that it's easier to hold a poke when the selection conditions are met. This makes scrolling UGUI canvases easier and makes poke interactions feel more consistent. - Changed AR Scale Interactable so changing the Min Scale and/or Max Scale during runtime will keep the current object scale if still within range instead of resizing the object to keep the same scale ratio. ### Fixed - Fixed the Hands Interaction Demo sample to wait to activate the controller GameObjects until they are reconnected instead of each time hand tracking is lost. Also fixed the controllers appearing at the origin if they have never been tracked. - Fixed the Hands Interaction Demo sample so it disables the hand interactors while doing a system gesture (such as a user looking at their open palm at eye level). - Fixed warning about a self-intersecting polygon in the `Frame.fbx` model in the Hands Interaction Demo sample. - Fixed warning in Hands Interaction Demo sample about obsolete API usage coming from the hands subsystem. - Fixed `XRSimulatedController` and `XRSimulatedHMD` to have identifying characteristics information in the `capabilities` field of their corresponding `InputDeviceDescription`. ([XRIT-50](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-50)) - Fixed an issue in the `XRController` class where the `inputDevice` property was not reinitialized when the `controllerNode` property was changed. ([XRIT-52](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-52)) - UGUI ray interactions are now correctly blocked when interaction groups block ray interactions and the ray is hidden. - Fixed an issue with `TrackedDeviceGraphicRaycaster`, when using the `XRPokeInteractor` on UGUI canvases with different sort orders, where interaction was blocked on all but the highest Order in Layer valued canvas. ([XRIT-48](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-48)) - Fixed an issue with `TrackedDeviceGraphicsRaycaster`, where opening a dropdown would block all other UGUI canvases to become non-interactable with an `XRPokeInteractor` until the dropdown was closed. - Fixed the `Starter Assets` and `Hands Interaction Demo` prefabs which contained components and shaders with a mix of both Built-in Render Pipeline and Universal Render Pipeline. They are all now using Built-in Render Pipeline for consistency. - Fixed `XRInteractorReticleVisual` incorrect rotation around `y` axis when aligning prefab to surface normal. ([XRIT-18](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-18)) - Fixed `XRInteractorReticleVisual` incorrect rotation when `AlignPrefabWithSurfaceNormal` is `false`. - Fixed `XRInteractorReticleVisual` inconsistent rotation when `AlignPrefabWithSurfaceNormal` and `DrawOnNoHit` are `true` but there is no active hit. - Fixed `UIInputModule` issue where tracked devices cannot drag on UI elements when `Cursor.lockState` is set to `Locked`.
1 parent 3c12221 commit 4cd52a8

File tree

59 files changed

+2953
-2847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2953
-2847
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
<!-- Headers should be listed in this order: Added, Changed, Deprecated, Removed, Fixed, Security -->
8+
## [2.3.1] - 2023-03-27
9+
10+
### Added
11+
- Added System Gesture Detector component to the Hands Interaction Demo sample to add system gesture and menu palm pinch gesture events. Added sound upon menu press as an example. Added Aim Flags input actions to the `XRI Default Input Actions` in the Starter Assets sample to support this.
12+
- Added [Interaction filters](../manual/interaction-filters.md) documentation for `IXRHoverFilter`, `IXRSelectFilter`, `IXRInteractionStrengthFilter`, and the corresponding filter delegates with examples.
13+
14+
### Changed
15+
- Changed the Poke Gesture Detector component in the Hands Interaction Demo sample to no longer end the poke gesture when hand tracking is lost. This fixes the Ray Interactor line visual reappearing when hand tracking is lost while doing the poke gesture.
16+
- Changed `XRInteractorReticleVisual` to ensure consistent attempts to align the reticle prefab's `z` axis with the `transform.up` of the XROrigin when `AlignPrefabWithSurfaceNormal` is `true` and aligning with a non-horizontal surface.
17+
- Changed `XRInteractorReticleVisual` to align the reticle prefab's `z` axis with the forward direction of the reticle's interactor when `AlignPrefabWithSurfaceNormal` is `true` and aligning with a horizontal surface.
18+
- Updated installation documentation with convenience links for installing the XRI package on older versions of Unity 2021 where the package was not included in the main Editor manifest.
19+
- Changed so UGUI poke interactions are now considered to be blocking interactions for interaction groups. This allows rays to be properly hidden when hovering or selecting a UGUI canvas with poke.
20+
- Changed to use velocity estimation of poke interactor to add an extra validation mechanism in the XR Poke Filter hover validation check to allow poke selection to occur in cases where it was previously rejected, while still preventing poking from behind and other non-desireable cases.
21+
- Changed to cache poke selection validation check so that it's easier to hold a poke when the selection conditions are met. This makes scrolling UGUI canvases easier and makes poke interactions feel more consistent.
22+
- Changed AR Scale Interactable so changing the Min Scale and/or Max Scale during runtime will keep the current object scale if still within range instead of resizing the object to keep the same scale ratio.
23+
24+
### Fixed
25+
- Fixed the Hands Interaction Demo sample to wait to activate the controller GameObjects until they are reconnected instead of each time hand tracking is lost. Also fixed the controllers appearing at the origin if they have never been tracked.
26+
- Fixed the Hands Interaction Demo sample so it disables the hand interactors while doing a system gesture (such as a user looking at their open palm at eye level).
27+
- Fixed warning about a self-intersecting polygon in the `Frame.fbx` model in the Hands Interaction Demo sample.
28+
- Fixed warning in Hands Interaction Demo sample about obsolete API usage coming from the hands subsystem.
29+
- Fixed `XRSimulatedController` and `XRSimulatedHMD` to have identifying characteristics information in the `capabilities` field of their corresponding `InputDeviceDescription`. ([XRIT-50](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-50))
30+
- Fixed an issue in the `XRController` class where the `inputDevice` property was not reinitialized when the `controllerNode` property was changed. ([XRIT-52](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-52))
31+
- UGUI ray interactions are now correctly blocked when interaction groups block ray interactions and the ray is hidden.
32+
- Fixed an issue with `TrackedDeviceGraphicRaycaster`, when using the `XRPokeInteractor` on UGUI canvases with different sort orders, where interaction was blocked on all but the highest Order in Layer valued canvas. ([XRIT-48](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-48))
33+
- Fixed an issue with `TrackedDeviceGraphicsRaycaster`, where opening a dropdown would block all other UGUI canvases to become non-interactable with an `XRPokeInteractor` until the dropdown was closed.
34+
- Fixed the `Starter Assets` and `Hands Interaction Demo` prefabs which contained components and shaders with a mix of both Built-in Render Pipeline and Universal Render Pipeline. They are all now using Built-in Render Pipeline for consistency.
35+
- Fixed `XRInteractorReticleVisual` incorrect rotation around `y` axis when aligning prefab to surface normal. ([XRIT-18](https://issuetracker.unity3d.com/product/unity/issues/guid/XRIT-18))
36+
- Fixed `XRInteractorReticleVisual` incorrect rotation when `AlignPrefabWithSurfaceNormal` is `false`.
37+
- Fixed `XRInteractorReticleVisual` inconsistent rotation when `AlignPrefabWithSurfaceNormal` and `DrawOnNoHit` are `true` but there is no active hit.
38+
- Fixed `UIInputModule` issue where tracked devices cannot drag on UI elements when `Cursor.lockState` is set to `Locked`.
39+
840
## [2.3.0] - 2023-02-17
941

1042
### Added
157 KB
Loading
11.2 KB
Loading
124 KB
Loading
151 KB
Loading
0 Bytes
Loading

Documentation~/includes/version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.3.1

Documentation~/installation.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ To install this package, refer to the instructions that match your Unity Editor
44

55
## Version 2022.1 and later
66

7-
To install this package, follow the [installation instructions in the Unity User Manual](https://docs.unity3d.com/2022.1/Documentation/Manual/upm-ui-install.html).
7+
To install this package, follow the [installation instructions in the Unity User Manual](https://docs.unity3d.com/2022.1/Documentation/Manual/upm-ui-install.html) or click the following link to open Package Manager in your currently open project:
8+
[com.unity.xr.interaction.toolkit](com.unity3d.kharma:upmpackage/com.unity.xr.interaction.toolkit). This will bring up the **Add package by name** box with an optional version field. Click **Add** to install the latest verified version of XRI for your Unity Editor version.
89

910
## Version 2021.3
1011

@@ -14,13 +15,24 @@ To install this package (minimum version: 2.0.4), follow the [installation instr
1415

1516
### 2021.3.8f1 and earlier
1617

17-
To install this package, follow the instructions for [adding a package by name](https://docs.unity3d.com/2021.3/Documentation/Manual/upm-ui-quick.html) in the Unity Editor.
18+
This package was not listed in the Editor manifest in earlier versions of Unity 2021. Due to this, installation is a manual process. To install this package:
19+
1. Open the project that you plan to use.
20+
1. Click the following link to bring up the **Add package by name** window in Package Manager:
21+
[com.unity.xr.interaction.toolkit](com.unity3d.kharma:upmpackage/com.unity.xr.interaction.toolkit@2.3.1)
22+
23+
![installation-add-package-by-name](images/installation-add-package-by-name.png)
24+
25+
1. The version should be automatically populated, but please ensure that it is the correct version by referring to the table below.
26+
1. Click **Add**.
1827

1928
|Text Field|Value|
2029
|---|---|
2130
|**Name**|`com.unity.xr.interaction.toolkit`|
2231
|**Version (optional)**|**[!include[](includes/version.md)]**|
2332

33+
> [!NOTE]
34+
> Computer configuration issues can prevent package links from opening directly in the Unity Editor. If this happens, follow the instructions in [Adding a registry package by name](https://docs.unity3d.com/2021.3/Documentation/Manual/upm-ui-quick.html), using the information in the table above.
35+
2436
## Version 2020.3
2537

2638
To install this package, follow the [installation instructions in the Unity User Manual](https://docs.unity3d.com/2020.3/Documentation/Manual/upm-ui-install.html).
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# Interaction filters
2+
3+
Interaction filters are used to add additional checks to an Interactor and Interactable interaction after the base class validations are passed.
4+
5+
The interaction filters also include an implementation of a filter delegate that forwards the filter processing to a delegate. This enables users to add additional filter logic without needing to create new classes.
6+
7+
The current interaction filters supported in XRI are:
8+
9+
- [Hover filter](#hover-filter)
10+
- [Select filter](#select-filter)
11+
- [Interaction strength filter](#interaction-strength-filter)
12+
13+
## Hover filter
14+
15+
[`IXRHoverFilter`](xref:UnityEngine.XR.Interaction.Toolkit.Filtering.IXRHoverFilter) is an interface that allows additional filter processing between an [`IXRHoverInteractor`](xref:UnityEngine.XR.Interaction.Toolkit.IXRHoverInteractor) and an [`IXRHoverInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.IXRHoverInteractable).
16+
17+
### Usage
18+
19+
An `IXRHoverFilter` can be added to the following objects to extend its hover validation:
20+
21+
|Object|Usage|
22+
|---|---|
23+
|**[`XRInteractionManager`](xref:UnityEngine.XR.Interaction.Toolkit.XRInteractionManager)**|A hover filter added to the Interaction Manager is used to validate all hover interactions globally in the manager.|
24+
|**[`XRBaseInteractor`](xref:UnityEngine.XR.Interaction.Toolkit.XRBaseInteractor)**|A hover filter added to an Interactor is used to validate the hover interactions in the Interactor.|
25+
|**[`XRBaseInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable)**|A hover filter added to an Interactable is used to validate the hover interactions in the Interactable.|
26+
27+
### Interface definition
28+
29+
|Property|Description|
30+
|---|---|
31+
|**bool `canProcess`**|Whether this hover filter can process interactions. Hover filters that can process interactions receive calls to `IXRHoverFilter.Process`; hover filters that cannot process do not call `IXRHoverFilter.Process`. It's recommended to return `isActiveAndEnabled` when implementing this interface in a `MonoBehaviour`.|
32+
33+
|Method|Description|
34+
|---|---|
35+
|**bool `Process(IXRHoverInteractor interactor, IXRHoverInteractable interactable)`**|Called by the host object (`XRInteractionManager`, `XRBaseInteractor` or `XRBaseInteractable`) to verify if the hover interaction between the given Interactor and Interactable can be performed. Returns `true` when the given Interactor can hover the given Interactable. Otherwise, returns `false`.|
36+
37+
### Setup
38+
39+
Add the implementation of `IXRHoverFilter` component to a GameObject and add it to the `Starting Hover Filters` property of an `XRInteractionManager`, `XRBaseInteractor`, or `XRBaseInteractable`. Filters in the `Starting Hover Filters` list will automatically be linked and applied to their respective host object.
40+
41+
![hover-filter-setup](images/hover-filter-setup.png)
42+
43+
Multiple hover filters can be added to a single Interaction Manager, Interactor, or Interactable.
44+
45+
### Example
46+
47+
```c#
48+
using UnityEngine;
49+
using UnityEngine.XR.Interaction.Toolkit;
50+
using UnityEngine.XR.Interaction.Toolkit.Filtering;
51+
52+
public class CustomHoverFilter : MonoBehaviour, IXRHoverFilter
53+
{
54+
public bool canProcess => isActiveAndEnabled;
55+
56+
public bool Process(IXRHoverInteractor interactor, IXRHoverInteractable interactable)
57+
{
58+
bool canHover = true;
59+
// Do any additional validation checks on the interactor and interactable.
60+
return canHover;
61+
}
62+
}
63+
```
64+
65+
## Select filter
66+
67+
[`IXRSelectFilter`](xref:UnityEngine.XR.Interaction.Toolkit.Filtering.IXRSelectFilter) is an interface that allows additional filter processing between an [`IXRSelectInteractor`](xref:UnityEngine.XR.Interaction.Toolkit.IXRSelectInteractor) and an [`IXRSelectInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.IXRSelectInteractable).
68+
69+
### Usage
70+
71+
An `IXRSelectFilter` can be added following objects to extend its select validation:
72+
73+
|Object|Usage|
74+
|---|---|
75+
|**[`XRInteractionManager`](xref:UnityEngine.XR.Interaction.Toolkit.XRInteractionManager)**|A select filter added to the Interaction Manager is used to validate all select interactions globally in the manager.|
76+
|**[`XRBaseInteractor`](xref:UnityEngine.XR.Interaction.Toolkit.XRBaseInteractor)**|A select filter added to an Interactor is used to validate the select interactions in the Interactor.|
77+
|**[`XRBaseInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable)**|A select filter added to an Interactable is used to validate the select interactions in the Interactable.|
78+
79+
### Interface definition
80+
81+
|Property|Description|
82+
|---|---|
83+
|**bool `canProcess`**|Whether this select filter can process interactions. Select filters that can process interactions receive calls to `IXRSelectFilter.Process`. Select filters that cannot process do not call `IXRSelectFilter.Process`. It's recommended to return `isActiveAndEnabled` when implementing this interface in a `MonoBehaviour`.|
84+
85+
|Method|Description|
86+
|---|---|
87+
|**bool `Process(IXRSelectInteractor interactor, IXRSelectInteractable interactable)`**|Called by the host object (`XRInteractionManager`, `XRBaseInteractor` or `XRBaseInteractable`) to verify if the select interaction between the given Interactor and Interactable can be performed. Returns `true` when the given Interactor can select the given Interactable. Otherwise, returns `false`.|
88+
89+
### Setup
90+
91+
Add the implementation of `IXRSelectFilter` component to a GameObject and add it to the `Starting Select Filters` property of an `XRInteractionManager`, `XRBaseInteractor`, or `XRBaseInteractable`. Filters in the `Starting Select Filters` list will automatically be linked and applied to their respective host object.
92+
93+
![select-filter-setup](images/select-filter-setup.png)
94+
95+
Multiple select filters can be added to a single Interaction Manager, Interactor, or Interactable.
96+
97+
98+
### Example
99+
100+
```c#
101+
using UnityEngine;
102+
using UnityEngine.XR.Interaction.Toolkit;
103+
using UnityEngine.XR.Interaction.Toolkit.Filtering;
104+
105+
public class CustomSelectFilter : MonoBehaviour, IXRSelectFilter
106+
{
107+
public bool canProcess => isActiveAndEnabled;
108+
109+
public bool Process(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
110+
{
111+
bool canSelect = true;
112+
// Do additional validation checks on the interactor and interactable.
113+
return canSelect;
114+
}
115+
}
116+
```
117+
118+
## Interaction strength filter
119+
120+
[`IXRInteractionStrengthFilter`](xerf:UnityEngine.XR.Interaction.Toolkit.Filtering.IXRInteractionStrengthFilter) is an interface used to adjust or set the interaction strength between an [`IXRInteractor`](xref:UnityEngine.XR.Interaction.Toolkit.IXRInteractor) and [`IXRInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.IXRInteractable).
121+
122+
### Usage
123+
124+
An `IXRInteractionStrengthFilter` can be added following objects to extend its interaction strength computation:
125+
126+
|Object|Usage|
127+
|---|---|
128+
|**[`XRBaseInteractable`](xref:UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable)**| An interaction strength filter added to an Interactable is used to modify the interaction strength in the Interactable for a hovering or selecting Interactor.|
129+
130+
### Interface definition
131+
132+
|Property|Description|
133+
|---|---|
134+
|**bool `canProcess`**|Whether this interaction strength filter can process interactions. Interaction strength filters that can process interactions receive calls to `IXRInteractionStrengthFilter.Process`. Interaction strength filters that cannot process do not receive calls to `IXRInteractionStrengthFilter.Process`. It's recommended to return `isActiveAndEnabled` when implementing this interface in a `MonoBehaviour`.|
135+
136+
|Method|Description|
137+
|---|---|
138+
|**float `Process(IXRInteractor interactor, IXRInteractable interactable, float interactionStrength)`**|Called by the host object (`XRBaseInteractable`) to calculate the interaction strength between the given Interactor and Interactable. Returns the modified interaction strength that is the result of passing the interaction strength through the filter.|
139+
140+
### Setup
141+
142+
Add the implementation of `IXRInteractionStrengthFilter` component to a GameObject and add it to the `Starting Interaction Strength Filters` property of an `XRBaseInteractable`. Filters in the `Starting Interaction Strength Filters` list will automatically be linked and applied to their respective host object.
143+
144+
![select-filter-setup](images/select-filter-setup.png)
145+
146+
Multiple interaction strength filters can be added to a single Interactable.
147+
148+
### Example
149+
150+
```c#
151+
using UnityEngine;
152+
using UnityEngine.XR.Interaction.Toolkit;
153+
using UnityEngine.XR.Interaction.Toolkit.Filtering;
154+
155+
public class CustomInteractionStrengthFilter : MonoBehaviour, IXRInteractionStrengthFilter
156+
{
157+
public bool canProcess => isActiveAndEnabled;
158+
159+
public float Process(IXRInteractor interactor, IXRInteractable interactable, float interactionStrength)
160+
{
161+
float modifiedInteractionStrength = interactionStrength;
162+
// Do any modification the interaction strength value based on the interactor and the interactable.
163+
return modifiedInteractionStrength;
164+
}
165+
}
166+
```
167+
168+
## Delegates
169+
170+
`IXRHoverFilter`, `IXRSelectFilter`, `IXRInteractionStrength` each contain an implementation of a filter delegate that forwards the filter processing to a delegate. This enables users to add additional filter logic without needing to create new classes.
171+
172+
With filter delegates you provide a callback function that runs as the filter's `Process` method. Filter delegates also provide access to a `canProcess` property as well.
173+
174+
### Example
175+
176+
```c#
177+
using UnityEngine.XR.Interaction.Toolkit;
178+
using UnityEngine.XR.Interaction.Toolkit.Filtering;
179+
180+
public class FilterDelegateExampleInteractable : XRBaseInteractable
181+
{
182+
// Call this method to add the custom filters
183+
void SetupFilters()
184+
{
185+
var hoverFilterDelegate = new XRHoverFilterDelegate((interactor, interactable) =>
186+
{
187+
bool canHover = false;
188+
// Do any additional validation checks on the interactor and interactable.
189+
return canHover;
190+
});
191+
192+
var selectFilterDelegate = new XRSelectFilterDelegate((interactor, interactable) =>
193+
{
194+
bool canSelect = false;
195+
// Do any additional validation checks on the interactor and interactable.
196+
return canSelect;
197+
});
198+
199+
var interactionStrengthFilterDelegate = new XRInteractionStrengthFilterDelegate((interactor, interactable, interactionStrength) =>
200+
{
201+
float modifiedInteractionStrength = interactionStrength;
202+
// Do any modification the interaction strength value based on the interactor and the interactable.
203+
return modifiedInteractionStrength;
204+
});
205+
206+
// Filter delegates can modify the filter's canProcess property. Example:
207+
hoverFilterDelegate.canProcess = false;
208+
209+
// Link the filter by adding the filter delegate to the filters list to ensure it is processed
210+
hoverFilters.Add(hoverFilterDelegate);
211+
selectFilters.Add(selectFilterDelegate);
212+
interactionStrengthFilters.Add(interactionStrengthFilterDelegate);
213+
}
214+
}
215+
```

0 commit comments

Comments
 (0)