Skip to content

Commit 9f60fa8

Browse files
committed
Fixed WebXR input profiles loading on SteamVR
1 parent 41c4151 commit 9f60fa8

File tree

8 files changed

+35
-10
lines changed

8 files changed

+35
-10
lines changed

Build/Build/Build.data

23.6 KB
Binary file not shown.

Build/Build/Build.framework.js

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

Build/Build/Build.wasm

49 KB
Binary file not shown.

Packages/webxr-interactions/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Spectator Camera.
1111
- Mixed Reality Capture.
1212

13+
### Fixed
14+
- WebXR input profiles loading on SteamVR.
15+
1316
## [0.15.0] - 2022-06-04
1417
### Changed
1518
- Requires WebXR Export 0.15.0.

Packages/webxr-interactions/Runtime/Scripts/ControllerInteraction.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,11 @@ public bool GetUseInputProfile()
206206

207207
private void SetControllerVisible(bool visible)
208208
{
209-
controllerVisible = visible;
210-
Drop();
209+
if (controllerVisible != visible)
210+
{
211+
controllerVisible = visible;
212+
Drop();
213+
}
211214
#if WEBXR_INPUT_PROFILES
212215
// We want to use WebXR Input Profiles
213216
if (visible && useInputProfile)
@@ -249,8 +252,11 @@ private void SetInputProfileModelPose(bool alwaysUseGrip)
249252

250253
private void SetHandJointsVisible(bool visible)
251254
{
252-
handJointsVisible = visible;
253-
Drop();
255+
if (handJointsVisible != visible)
256+
{
257+
handJointsVisible = visible;
258+
Drop();
259+
}
254260
#if WEBXR_INPUT_PROFILES
255261
// We want to use WebXR Input Profiles
256262
if (visible && useInputProfile)
@@ -357,6 +363,10 @@ private void HandleProfilesList(Dictionary<string, string> profilesList)
357363

358364
private void LoadInputProfile()
359365
{
366+
if (!string.IsNullOrEmpty(loadedProfile))
367+
{
368+
return;
369+
}
360370
// Start loading possible profiles for the controller
361371
var profiles = controller.GetProfiles();
362372
if (hasProfileList && profiles != null && profiles.Length > 0)

Packages/webxr/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Support for Spectator Camera.
1111

12+
### Fixed
13+
- WebXR input profiles loading on SteamVR.
14+
1215
## [0.15.0] - 2022-06-04
1316
### Added
1417
- GetButtonTouched to WebXRController, to support buttons touched values.

Packages/webxr/Runtime/Plugins/WebGL/webxr.jspre

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ setTimeout(function () {
735735
Module.HEAPF32[controller.enabledIndex] = 1; // XRControllerData.enabled
736736
Module.HEAPF32[controller.handIndex] = hand; // XRControllerData.hand
737737

738-
if (controller.updatedProfiles == 0) {
738+
if (controller.updatedProfiles == 0 && inputSource.profiles.length > 0) {
739739
controller.profiles = inputSource.profiles;
740740
controller.updatedProfiles = 1;
741741
}

Packages/webxr/Runtime/Scripts/WebXRController.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,12 @@ private void OnControllerUpdate(WebXRControllerData controllerData)
358358
return;
359359
}
360360

361-
profiles = controllerData.profiles;
361+
bool profilesUpdated = false;
362+
if (profiles != controllerData.profiles)
363+
{
364+
profiles = controllerData.profiles;
365+
profilesUpdated = true;
366+
}
362367

363368
if (oculusLinkBugTest != 1)
364369
{
@@ -412,7 +417,7 @@ private void OnControllerUpdate(WebXRControllerData controllerData)
412417
UpdateAllButtons();
413418
}
414419

415-
SetControllerActive(true);
420+
SetControllerActive(true, profilesUpdated);
416421
}
417422
}
418423

@@ -483,10 +488,14 @@ private void OnHandUpdateInternal(WebXRHandData handData)
483488
}
484489
}
485490

486-
private void SetControllerActive(bool active)
491+
private void SetControllerActive(bool active, bool forceReport = false)
487492
{
488493
if (controllerActive == active)
489494
{
495+
if (forceReport)
496+
{
497+
OnControllerActive?.Invoke(controllerActive);
498+
}
490499
return;
491500
}
492501
if (!active)

0 commit comments

Comments
 (0)