Skip to content

Commit 68d15b8

Browse files
committed
feat(InputActionProperty): add functionality based around InputActions
The InputActionProperty of the Unity Input System allows for listening to Input System Action events directly based off an input system action reference or from a direct binding. This is cleaner and easier to understand than the CallbackContext with Unity Events so it has been used to create some new prefabs in the samples directory. The new InputActionPropertyVelocityTracker will track velocity of an input system action which can be based off OpenXR device data, meaning the velocity reported should be compatible with the specific device rather than trying to use estimations. The new InputActionPropertyTransformer can also be used in place of the CallbackContextTransformer to provide a direct reference to an Input Action (or direct binding) which can be used to pick up action input directly within the component rather than having to go through the PlayerInput script and pass the context via a Unity Event to the CallbackContextTransformer. The InputActions_GenericXR.inputactions mapping has also been updated to include pose data for the HMD, controllers and pointer, which includes position, rotation and velocity information. This has all formalised in the creation of two new prefabs: * UnityInputSystem.Poses.GenericXR.prefab - contains tracked poses for the new pose data. * UnityInputSystem.InputActionMappings.GenericXR.prefab - contains all of the input buttons, axis data, etc for the generic controllers using the new InputActionPropertyTransformer, which makes it easier to see how to customise the system. This has also meant the UnityInputSystem.Mappings.GenericXR.prefab has been renamed to UnityInputSystem.CallbackContextMappings.GenericXR.prefab and this should not technically be considered as deprecated as it may still be useful or even the preferred usage, but by default the new InputActionMappings.GenericXR.prefab should be used.
1 parent be160b9 commit 68d15b8

58 files changed

Lines changed: 10555 additions & 2032 deletions

File tree

Some content is hidden

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

Documentation/API/Tracking.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/API/Tracking/Velocity.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
# Class InputActionPropertyVelocityTracker
2+
3+
Retrieves the velocity and angular velocity from the specified InputActionProperty.
4+
5+
## Contents
6+
7+
* [Inheritance]
8+
* [Namespace]
9+
* [Syntax]
10+
* [Fields]
11+
* [currentAngularVelocity]
12+
* [currentVelocity]
13+
* [Properties]
14+
* [AngularVelocitySource]
15+
* [VelocitySource]
16+
* [Methods]
17+
* [AngularVelocityActionCanceled(InputAction.CallbackContext)]
18+
* [AngularVelocityActionPerformed(InputAction.CallbackContext)]
19+
* [BindAngularVelocityActions()]
20+
* [BindVelocityActions()]
21+
* [DisableAction(InputActionProperty)]
22+
* [DoGetAngularVelocity()]
23+
* [DoGetVelocity()]
24+
* [EnableAction(InputActionProperty)]
25+
* [OnDisable()]
26+
* [OnEnable()]
27+
* [UnbindAngularVelocityActions()]
28+
* [UnbindVelocityActions()]
29+
* [VelocityActionCanceled(InputAction.CallbackContext)]
30+
* [VelocityActionPerformed(InputAction.CallbackContext)]
31+
32+
## Details
33+
34+
##### Inheritance
35+
36+
* System.Object
37+
* InputActionPropertyVelocityTracker
38+
39+
##### Namespace
40+
41+
* [Tilia.Input.UnityInputSystem.Tracking.Velocity]
42+
43+
##### Syntax
44+
45+
```
46+
public class InputActionPropertyVelocityTracker : VelocityTracker
47+
```
48+
49+
### Fields
50+
51+
#### currentAngularVelocity
52+
53+
The current angular velocity.
54+
55+
##### Declaration
56+
57+
```
58+
protected Vector3 currentAngularVelocity
59+
```
60+
61+
#### currentVelocity
62+
63+
The current velocity.
64+
65+
##### Declaration
66+
67+
```
68+
protected Vector3 currentVelocity
69+
```
70+
71+
### Properties
72+
73+
#### AngularVelocitySource
74+
75+
The InputActionProperty containing the angular velocity source.
76+
77+
##### Declaration
78+
79+
```
80+
public InputActionProperty AngularVelocitySource { get; set; }
81+
```
82+
83+
#### VelocitySource
84+
85+
The InputActionProperty containing the velocity source.
86+
87+
##### Declaration
88+
89+
```
90+
public InputActionProperty VelocitySource { get; set; }
91+
```
92+
93+
### Methods
94+
95+
#### AngularVelocityActionCanceled(InputAction.CallbackContext)
96+
97+
Processes the context when the angular velocity InputActionProperty is canceled.
98+
99+
##### Declaration
100+
101+
```
102+
protected virtual void AngularVelocityActionCanceled(InputAction.CallbackContext context)
103+
```
104+
105+
##### Parameters
106+
107+
| Type | Name | Description |
108+
| --- | --- | --- |
109+
| InputAction.CallbackContext | context | The action context data. |
110+
111+
#### AngularVelocityActionPerformed(InputAction.CallbackContext)
112+
113+
Processes the context when the angular velocity InputActionProperty is performed.
114+
115+
##### Declaration
116+
117+
```
118+
protected virtual void AngularVelocityActionPerformed(InputAction.CallbackContext context)
119+
```
120+
121+
##### Parameters
122+
123+
| Type | Name | Description |
124+
| --- | --- | --- |
125+
| InputAction.CallbackContext | context | The action context data. |
126+
127+
#### BindAngularVelocityActions()
128+
129+
Binds the angular velocity performed and canceled actions to the processing methods.
130+
131+
##### Declaration
132+
133+
```
134+
protected virtual void BindAngularVelocityActions()
135+
```
136+
137+
#### BindVelocityActions()
138+
139+
Binds the velocity performed and canceled actions to the processing methods.
140+
141+
##### Declaration
142+
143+
```
144+
protected virtual void BindVelocityActions()
145+
```
146+
147+
#### DisableAction(InputActionProperty)
148+
149+
Disables the given InputActionProperty.
150+
151+
##### Declaration
152+
153+
```
154+
protected virtual void DisableAction(InputActionProperty property)
155+
```
156+
157+
##### Parameters
158+
159+
| Type | Name | Description |
160+
| --- | --- | --- |
161+
| InputActionProperty | property | The property to disable. |
162+
163+
#### DoGetAngularVelocity()
164+
165+
##### Declaration
166+
167+
```
168+
protected override Vector3 DoGetAngularVelocity()
169+
```
170+
171+
##### Returns
172+
173+
| Type | Description |
174+
| --- | --- |
175+
| Vector3 | n/a |
176+
177+
#### DoGetVelocity()
178+
179+
##### Declaration
180+
181+
```
182+
protected override Vector3 DoGetVelocity()
183+
```
184+
185+
##### Returns
186+
187+
| Type | Description |
188+
| --- | --- |
189+
| Vector3 | n/a |
190+
191+
#### EnableAction(InputActionProperty)
192+
193+
Enables the given InputActionProperty.
194+
195+
##### Declaration
196+
197+
```
198+
protected virtual void EnableAction(InputActionProperty property)
199+
```
200+
201+
##### Parameters
202+
203+
| Type | Name | Description |
204+
| --- | --- | --- |
205+
| InputActionProperty | property | The property to enable. |
206+
207+
#### OnDisable()
208+
209+
##### Declaration
210+
211+
```
212+
protected virtual void OnDisable()
213+
```
214+
215+
#### OnEnable()
216+
217+
##### Declaration
218+
219+
```
220+
protected virtual void OnEnable()
221+
```
222+
223+
#### UnbindAngularVelocityActions()
224+
225+
Unbinds the velocity performed and canceled actions from the processing methods.
226+
227+
##### Declaration
228+
229+
```
230+
protected virtual void UnbindAngularVelocityActions()
231+
```
232+
233+
#### UnbindVelocityActions()
234+
235+
Unbinds the velocity performed and canceled actions from the processing methods.
236+
237+
##### Declaration
238+
239+
```
240+
protected virtual void UnbindVelocityActions()
241+
```
242+
243+
#### VelocityActionCanceled(InputAction.CallbackContext)
244+
245+
Processes the context when the velocity InputActionProperty is canceled.
246+
247+
##### Declaration
248+
249+
```
250+
protected virtual void VelocityActionCanceled(InputAction.CallbackContext context)
251+
```
252+
253+
##### Parameters
254+
255+
| Type | Name | Description |
256+
| --- | --- | --- |
257+
| InputAction.CallbackContext | context | The action context data. |
258+
259+
#### VelocityActionPerformed(InputAction.CallbackContext)
260+
261+
Processes the context when the velocity InputActionProperty is performed.
262+
263+
##### Declaration
264+
265+
```
266+
protected virtual void VelocityActionPerformed(InputAction.CallbackContext context)
267+
```
268+
269+
##### Parameters
270+
271+
| Type | Name | Description |
272+
| --- | --- | --- |
273+
| InputAction.CallbackContext | context | The action context data. |
274+
275+
[Tilia.Input.UnityInputSystem.Tracking.Velocity]: README.md
276+
[Inheritance]: #Inheritance
277+
[Namespace]: #Namespace
278+
[Syntax]: #Syntax
279+
[Fields]: #Fields
280+
[currentAngularVelocity]: #currentAngularVelocity
281+
[currentVelocity]: #currentVelocity
282+
[Properties]: #Properties
283+
[AngularVelocitySource]: #AngularVelocitySource
284+
[VelocitySource]: #VelocitySource
285+
[Methods]: #Methods
286+
[AngularVelocityActionCanceled(InputAction.CallbackContext)]: #AngularVelocityActionCanceledInputAction.CallbackContext
287+
[AngularVelocityActionPerformed(InputAction.CallbackContext)]: #AngularVelocityActionPerformedInputAction.CallbackContext
288+
[BindAngularVelocityActions()]: #BindAngularVelocityActions
289+
[BindVelocityActions()]: #BindVelocityActions
290+
[DisableAction(InputActionProperty)]: #DisableActionInputActionProperty
291+
[DoGetAngularVelocity()]: #DoGetAngularVelocity
292+
[DoGetVelocity()]: #DoGetVelocity
293+
[EnableAction(InputActionProperty)]: #EnableActionInputActionProperty
294+
[OnDisable()]: #OnDisable
295+
[OnEnable()]: #OnEnable
296+
[UnbindAngularVelocityActions()]: #UnbindAngularVelocityActions
297+
[UnbindVelocityActions()]: #UnbindVelocityActions
298+
[VelocityActionCanceled(InputAction.CallbackContext)]: #VelocityActionCanceledInputAction.CallbackContext
299+
[VelocityActionPerformed(InputAction.CallbackContext)]: #VelocityActionPerformedInputAction.CallbackContext

Documentation/API/Transformation/Conversion/CallbackContextTransformer-2.ContextType.md.meta renamed to Documentation/API/Tracking/Velocity/InputActionPropertyVelocityTracker.md.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.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Namespace Tilia.Input.UnityInputSystem.Tracking.Velocity
2+
3+
### Classes
4+
5+
#### [InputActionPropertyVelocityTracker]
6+
7+
Retrieves the velocity and angular velocity from the specified InputActionProperty.
8+
9+
[InputActionPropertyVelocityTracker]: InputActionPropertyVelocityTracker.md

Documentation/API/Tracking/Velocity/README.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation/API/Transformation/Conversion/CallbackContextToBoolean.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ Transforms a InputAction.CallbackContext to a System.Boolean.
1515
##### Inheritance
1616

1717
* System.Object
18+
* [InputSystemTransformer]<InputAction.CallbackContext, System.Boolean, [CallbackContextToBoolean.UnityEvent]\>
1819
* [CallbackContextTransformer]<System.Boolean, [CallbackContextToBoolean.UnityEvent]\>
1920
* CallbackContextToBoolean
2021

2122
##### Inherited Members
2223

23-
[CallbackContextTransformer<Boolean, CallbackContextToBoolean.UnityEvent>.ContextToProcess]
24-
2524
[CallbackContextTransformer<Boolean, CallbackContextToBoolean.UnityEvent>.ProcessResult(InputAction.CallbackContext)]
2625

26+
[InputSystemTransformer<InputAction.CallbackContext, Boolean, CallbackContextToBoolean.UnityEvent>.ContextToProcess]
27+
2728
##### Namespace
2829

2930
* [Tilia.Input.UnityInputSystem.Transformation.Conversion]
@@ -58,10 +59,11 @@ protected override bool Process(InputAction.CallbackContext input)
5859
| --- | --- |
5960
| System.Boolean | The transformed value. |
6061

62+
[InputSystemTransformer]: InputSystemTransformer-3.md
6163
[CallbackContextTransformer]: CallbackContextTransformer-2.md
6264
[CallbackContextToBoolean.UnityEvent]: CallbackContextToBoolean.UnityEvent.md
63-
[CallbackContextTransformer<Boolean, CallbackContextToBoolean.UnityEvent>.ContextToProcess]: CallbackContextTransformer-2.md#Tilia_Input_UnityInputSystem_Transformation_Conversion_CallbackContextTransformer_2_ContextToProcess
6465
[CallbackContextTransformer<Boolean, CallbackContextToBoolean.UnityEvent>.ProcessResult(InputAction.CallbackContext)]: CallbackContextTransformer-2.md#Tilia_Input_UnityInputSystem_Transformation_Conversion_CallbackContextTransformer_2_ProcessResult_InputAction_CallbackContext_
66+
[InputSystemTransformer<InputAction.CallbackContext, Boolean, CallbackContextToBoolean.UnityEvent>.ContextToProcess]: InputSystemTransformer-3.md#Tilia_Input_UnityInputSystem_Transformation_Conversion_InputSystemTransformer_3_ContextToProcess
6567
[Tilia.Input.UnityInputSystem.Transformation.Conversion]: README.md
6668
[Inheritance]: #Inheritance
6769
[Namespace]: #Namespace

0 commit comments

Comments
 (0)