Skip to content

Commit d08941d

Browse files
committed
Version 2.0 - Windows MR, 2018.3 fixes, ModalThrowable, delayable init
Changes for v2.0rc4: * Support for Windows MR (no Skeletal input at this time - driver needs to be updated) * Added SteamVR_ActionIn.onActiveChange event (most actions inherit from this class) * Added Interactable.activateActionSetOnAttach to activate action sets when you grab an item and deactivate them when they're detached * Fixed an issue in the SteamVR Input Live View that made it unreadable * Fixed an issue that lead to duplicate SteamVR_Render components in some circumstances * Removed Debug UI from release builds using the Interaction System * Added ModalThrowable. Allowing different snap locations for grip and pinch pickups * Added grenade as an example of the ModalThrowable * Added a squishable object for a knuckles force example * Fixed an order of operations error where the interactable detach event was being called after the attach event when an item changed hands * Fixed an issue with pickup points being in odd places * Forcing hover unlock on interactable destruction * Added support for Unity 2018.3 * Fixed an issue with delayed init
1 parent 28923dc commit d08941d

File tree

161 files changed

+4776
-804
lines changed

Some content is hidden

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

161 files changed

+4776
-804
lines changed

Assets/SteamVR/Editor/SteamVR_Update.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99
using System.IO;
1010
using System.Text.RegularExpressions;
1111

12+
#if UNITY_2018_3_OR_NEWER
13+
#pragma warning disable CS0618
14+
#endif
15+
1216
namespace Valve.VR
1317
{
1418
[InitializeOnLoad]
1519
public class SteamVR_Update : EditorWindow
1620
{
17-
const string currentVersion = "1.2.3";
21+
const string currentVersion = "2.0";
1822
const string versionUrl = "http://media.steampowered.com/apps/steamvr/unitypluginversion.txt";
1923
const string notesUrl = "http://media.steampowered.com/apps/steamvr/unityplugin-v{0}.txt";
2024
const string pluginUrl = "http://u3d.as/content/valve-corporation/steam-vr-plugin";
@@ -169,4 +173,8 @@ public void OnGUI()
169173
}
170174
}
171175
}
172-
}
176+
}
177+
178+
#if UNITY_2018_3_OR_NEWER
179+
#pragma warning restore CS0618
180+
#endif

Assets/SteamVR/Input/Editor/SteamVR_Input_LiveWindow.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ private void OnGUI()
5454
SteamVR_Input_Sources source = sources[sourceIndex];
5555
EditorGUILayout.LabelField(source.ToString());
5656

57+
EditorGUI.indentLevel++;
58+
5759
for (int actionSetIndex = 0; actionSetIndex < actionSets.Length; actionSetIndex++)
5860
{
5961
SteamVR_ActionSet set = actionSets[actionSetIndex];
@@ -156,6 +158,7 @@ private void OnGUI()
156158
GUI.backgroundColor = defaultColor;
157159
}
158160

161+
EditorGUI.indentLevel--;
159162
EditorGUILayout.Space();
160163
}
161164

Assets/SteamVR/Input/ExampleJSON/actions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
{
9191
"controller_type": "knuckles",
9292
"binding_url": "bindings_knuckles.json"
93+
},
94+
{
95+
"controller_type": "holographic_controller",
96+
"binding_url": "bindings_holographic_controller.json"
9397
}
9498
],
9599
"localization": [
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
{
2+
"app_key" : "application.generated.unity.steamvr.exe",
3+
"bindings" : {
4+
"/actions/buggy" : {
5+
"sources" : [
6+
{
7+
"inputs" : {
8+
"pull" : {
9+
"output" : "/actions/buggy/in/throttle"
10+
}
11+
},
12+
"mode" : "trigger",
13+
"path" : "/user/hand/left/input/trigger"
14+
},
15+
{
16+
"inputs" : {
17+
"pull" : {
18+
"output" : "/actions/buggy/in/throttle"
19+
}
20+
},
21+
"mode" : "trigger",
22+
"path" : "/user/hand/right/input/trigger"
23+
},
24+
{
25+
"inputs" : {
26+
"position" : {
27+
"output" : "/actions/buggy/in/steering"
28+
}
29+
},
30+
"mode" : "joystick",
31+
"path" : "/user/hand/left/input/joystick"
32+
},
33+
{
34+
"inputs" : {
35+
"position" : {
36+
"output" : "/actions/buggy/in/steering"
37+
}
38+
},
39+
"mode" : "joystick",
40+
"path" : "/user/hand/right/input/joystick"
41+
},
42+
{
43+
"inputs" : {
44+
"click" : {
45+
"output" : "/actions/buggy/in/reset"
46+
}
47+
},
48+
"mode" : "button",
49+
"path" : "/user/hand/left/input/trackpad"
50+
},
51+
{
52+
"inputs" : {
53+
"click" : {
54+
"output" : "/actions/buggy/in/reset"
55+
}
56+
},
57+
"mode" : "button",
58+
"path" : "/user/hand/right/input/trackpad"
59+
},
60+
{
61+
"inputs" : {
62+
"click" : {
63+
"output" : "/actions/buggy/in/brake"
64+
}
65+
},
66+
"mode" : "button",
67+
"path" : "/user/hand/left/input/trackpad"
68+
},
69+
{
70+
"inputs" : {
71+
"click" : {
72+
"output" : "/actions/buggy/in/brake"
73+
}
74+
},
75+
"mode" : "button",
76+
"path" : "/user/hand/right/input/trackpad"
77+
}
78+
]
79+
},
80+
"/actions/default" : {
81+
"haptics" : [
82+
{
83+
"output" : "/actions/default/out/haptic",
84+
"path" : "/user/hand/left/output/haptic"
85+
},
86+
{
87+
"output" : "/actions/default/out/haptic",
88+
"path" : "/user/hand/right/output/haptic"
89+
}
90+
],
91+
"poses" : [
92+
{
93+
"output" : "/actions/default/in/pose",
94+
"path" : "/user/hand/left/pose/raw"
95+
},
96+
{
97+
"output" : "/actions/default/in/pose",
98+
"path" : "/user/hand/right/pose/raw"
99+
}
100+
],
101+
"sources" : [
102+
{
103+
"inputs" : {
104+
"click" : {
105+
"output" : "/actions/default/in/interactui"
106+
}
107+
},
108+
"mode" : "button",
109+
"path" : "/user/hand/left/input/trigger"
110+
},
111+
{
112+
"inputs" : {
113+
"click" : {
114+
"output" : "/actions/default/in/interactui"
115+
}
116+
},
117+
"mode" : "button",
118+
"path" : "/user/hand/right/input/trigger"
119+
},
120+
{
121+
"inputs" : {
122+
"click" : {
123+
"output" : "/actions/default/in/grabpinch"
124+
}
125+
},
126+
"mode" : "button",
127+
"parameters" : {
128+
"click_activate_threshold" : "0.95",
129+
"click_deactivate_threshold" : "0.9"
130+
},
131+
"path" : "/user/hand/left/input/trigger"
132+
},
133+
{
134+
"inputs" : {
135+
"click" : {
136+
"output" : "/actions/default/in/grabpinch"
137+
}
138+
},
139+
"mode" : "button",
140+
"parameters" : {
141+
"click_activate_threshold" : "0.95",
142+
"click_deactivate_threshold" : "0.9"
143+
},
144+
"path" : "/user/hand/right/input/trigger"
145+
},
146+
{
147+
"inputs" : {
148+
"click" : {
149+
"output" : "/actions/default/in/grabgrip"
150+
}
151+
},
152+
"mode" : "button",
153+
"path" : "/user/hand/left/input/grip"
154+
},
155+
{
156+
"inputs" : {
157+
"click" : {
158+
"output" : "/actions/default/in/grabgrip"
159+
}
160+
},
161+
"mode" : "button",
162+
"path" : "/user/hand/right/input/grip"
163+
},
164+
{
165+
"inputs" : {
166+
"pull" : {
167+
"output" : "/actions/default/in/squeeze"
168+
}
169+
},
170+
"mode" : "trigger",
171+
"path" : "/user/hand/left/input/trigger"
172+
},
173+
{
174+
"inputs" : {
175+
"pull" : {
176+
"output" : "/actions/default/in/squeeze"
177+
}
178+
},
179+
"mode" : "trigger",
180+
"path" : "/user/hand/right/input/trigger"
181+
},
182+
{
183+
"inputs" : {
184+
"click" : {
185+
"output" : "/actions/default/in/teleport"
186+
}
187+
},
188+
"mode" : "button",
189+
"path" : "/user/hand/left/input/trackpad"
190+
},
191+
{
192+
"inputs" : {
193+
"click" : {
194+
"output" : "/actions/default/in/teleport"
195+
}
196+
},
197+
"mode" : "button",
198+
"path" : "/user/hand/right/input/trackpad"
199+
}
200+
]
201+
},
202+
"/actions/platformer" : {
203+
"sources" : [
204+
{
205+
"inputs" : {
206+
"click" : {
207+
"output" : "/actions/platformer/in/jump"
208+
}
209+
},
210+
"mode" : "button",
211+
"path" : "/user/hand/left/input/trigger"
212+
},
213+
{
214+
"inputs" : {
215+
"click" : {
216+
"output" : "/actions/platformer/in/jump"
217+
}
218+
},
219+
"mode" : "button",
220+
"path" : "/user/hand/right/input/trigger"
221+
},
222+
{
223+
"inputs" : {
224+
"position" : {
225+
"output" : "/actions/platformer/in/move"
226+
}
227+
},
228+
"mode" : "joystick",
229+
"path" : "/user/hand/left/input/joystick"
230+
},
231+
{
232+
"inputs" : {
233+
"position" : {
234+
"output" : "/actions/platformer/in/move"
235+
}
236+
},
237+
"mode" : "joystick",
238+
"path" : "/user/hand/right/input/joystick"
239+
}
240+
]
241+
}
242+
},
243+
"controller_type" : "holographic_controller",
244+
"description" : "",
245+
"name" : "Default bindings for Windows Mixed Reality Controllers"
246+
}

Assets/SteamVR/Input/ExampleJSON/bindings_holographic_controller.json.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.

Assets/SteamVR/Input/ExampleJSON/bindings_vive_controller.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
}
219219
},
220220
"mode" : "button",
221-
"path" : "/user/hand/left/input/trigger"
221+
"path" : "/user/hand/left/input/trackpad"
222222
},
223223
{
224224
"inputs" : {
@@ -227,7 +227,7 @@
227227
}
228228
},
229229
"mode" : "button",
230-
"path" : "/user/hand/right/input/trigger"
230+
"path" : "/user/hand/right/input/trackpad"
231231
},
232232
{
233233
"inputs" : {

Assets/SteamVR/Input/SteamVR_Action_Boolean.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public override void UpdateValue(SteamVR_Input_Sources inputSource)
7979

8080
if (onUpdate[inputSource] != null)
8181
onUpdate[inputSource].Invoke(this);
82+
83+
if (onActiveChange[inputSource] != null && lastActionData[inputSource].bActive != active[inputSource])
84+
onActiveChange[inputSource].Invoke(this, active[inputSource]);
8285
}
8386

8487
/// <summary>Returns true if the value of the action has been set to true (from false) in the most recent update.</summary>

Assets/SteamVR/Input/SteamVR_Action_In.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public abstract class SteamVR_Action_In : SteamVR_Action
2727
[NonSerialized]
2828
protected Dictionary<SteamVR_Input_Sources, bool> changed = new Dictionary<SteamVR_Input_Sources, bool>(new SteamVR_Input_Sources_Comparer());
2929

30+
[NonSerialized]
31+
protected Dictionary<SteamVR_Input_Sources, Action<SteamVR_Action_In, bool>> onActiveChange = new Dictionary<SteamVR_Input_Sources, Action<SteamVR_Action_In, bool>>(new SteamVR_Input_Sources_Comparer());
32+
3033
[NonSerialized]
3134
protected Dictionary<SteamVR_Input_Sources, Action<SteamVR_Action_In>> onChange = new Dictionary<SteamVR_Input_Sources, Action<SteamVR_Action_In>>(new SteamVR_Input_Sources_Comparer());
3235

@@ -64,6 +67,7 @@ protected override void InitializeDictionaries(SteamVR_Input_Sources source)
6467
active.Add(source, false);
6568
changed.Add(source, false);
6669
onChange.Add(source, null);
70+
onActiveChange.Add(source, null);
6771
onUpdate.Add(source, null);
6872
lastInputOriginInfo.Add(source, new InputOriginInfo_t());
6973
lastOriginGetFrame.Add(source, -1);
@@ -145,6 +149,18 @@ protected void UpdateOriginTrackedDeviceInfo(SteamVR_Input_Sources inputSource)
145149
}
146150
}
147151

152+
/// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param>
153+
public void AddOnActiveChangeListener(Action<SteamVR_Action_In, bool> action, SteamVR_Input_Sources inputSource)
154+
{
155+
onActiveChange[inputSource] += action;
156+
}
157+
158+
/// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param>
159+
public void RemoveOnActiveChangeListener(Action<SteamVR_Action_In, bool> action, SteamVR_Input_Sources inputSource)
160+
{
161+
onActiveChange[inputSource] -= action;
162+
}
163+
148164
/// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param>
149165
public void AddOnChangeListener(Action<SteamVR_Action_In> action, SteamVR_Input_Sources inputSource)
150166
{

Assets/SteamVR/Input/SteamVR_Action_Pose.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ protected void CheckAndSendEvents(SteamVR_Input_Sources inputSource)
199199
if (onChange[inputSource] != null)
200200
onChange[inputSource].Invoke(this);
201201
}
202+
203+
if (onActiveChange[inputSource] != null && lastPoseActionData[inputSource].bActive != active[inputSource])
204+
onActiveChange[inputSource].Invoke(this, active[inputSource]);
202205
}
203206

204207
/// <param name="newUniverseOrigin">The origin of the universe. Don't get this wrong.</param>

Assets/SteamVR/Input/SteamVR_Action_Single.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public override void UpdateValue(SteamVR_Input_Sources inputSource)
6767
{
6868
onUpdate[inputSource].Invoke(this);
6969
}
70+
71+
if (onActiveChange[inputSource] != null && lastActionData[inputSource].bActive != active[inputSource])
72+
onActiveChange[inputSource].Invoke(this, active[inputSource]);
7073
}
7174

7275
/// <summary>The analog value</summary>

0 commit comments

Comments
 (0)