Skip to content

Commit 52ebcc8

Browse files
committed
Fix toggle Input Profiles Loader.
Shorter poke cylinder object.
1 parent 97d72e3 commit 52ebcc8

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

Packages/webxr-interactions/Runtime/InputSystem/WebXRControllerModel.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using UnityEngine.XR.Interaction.Toolkit;
99
#endif
1010
#if WEBXR_INPUT_PROFILES
11-
using UnityEngine.InputSystem.XR;
1211
using WebXRInputProfile;
1312
#endif
1413

@@ -137,8 +136,10 @@ public UpdateType updateType
137136

138137
[SerializeField]private XRBaseController xrController;
139138

139+
#if WEBXR_INPUT_PROFILES
140140
private InputProfileLoader inputProfileLoader;
141141
private InputProfileModel inputProfileModel;
142+
#endif
142143
private bool startedLoading = false;
143144
private bool hasProfileList = false;
144145
private string loadedProfile = null;
@@ -160,6 +161,7 @@ public UpdateType updateType
160161
private bool visualActionsInit;
161162
bool m_IsFirstUpdate = true;
162163

164+
#if WEBXR_INPUT_PROFILES
163165
void BindActions()
164166
{
165167
BindPosition();
@@ -393,6 +395,7 @@ protected void OnEnable()
393395
WebXRInputSystem.OnRightControllerProfiles += HandleOnControllerProfiles;
394396
break;
395397
}
398+
HandleOnControllerProfiles();
396399
}
397400

398401
/// <summary>
@@ -412,6 +415,10 @@ protected void OnDisable()
412415
WebXRInputSystem.OnRightControllerProfiles -= HandleOnControllerProfiles;
413416
break;
414417
}
418+
if (xrController != null && xrController.model != null)
419+
{
420+
xrController.model.gameObject.SetActive(true);
421+
}
415422
}
416423

417424
/// <summary>
@@ -559,6 +566,10 @@ private void HandleProfilesList(Dictionary<string, string> profilesList)
559566

560567
public void HandleOnControllerProfiles()
561568
{
569+
if (loadedModel)
570+
{
571+
HandleModelLoaded(loadedModel);
572+
}
562573
if (startedLoading)
563574
{
564575
return;
@@ -620,20 +631,17 @@ private void HandleModelLoaded(bool success)
620631
inputProfileModelTransform.localPosition = Vector3.zero;
621632
inputProfileModelTransform.localRotation = Quaternion.identity;
622633
inputProfileModelTransform.localScale = Vector3.one;
623-
if (xrController != null)
634+
if (xrController != null && xrController.model != null)
624635
{
625-
xrController.modelPrefab = null;
626-
if (xrController.model != null)
627-
{
628-
Destroy(xrController.model.gameObject);
629-
}
636+
xrController.model.gameObject.SetActive(false);
630637
}
631638

632639
if (m_CurrentTrackingState == TrackingStates.None)
633640
{
634641
inputProfileModel.gameObject.SetActive(false);
635642
}
636643
}
644+
#endif
637645
#endif
638646
}
639647
}

Packages/webxr-interactions/Samples~/XRInteractionToolkit/Prefabs/XR Origin (WebXR Rig).prefab

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ MonoBehaviour:
788788
m_EnableFly: 0
789789
m_UseGravity: 1
790790
m_GravityApplicationMode: 0
791-
m_ForwardSource: {fileID: 0}
791+
m_ForwardSource: {fileID: 5280121735958530868}
792792
m_LeftHandMoveAction:
793793
m_UseReference: 1
794794
m_Action:
@@ -2731,6 +2731,16 @@ PrefabInstance:
27312731
propertyPath: m_LocalEulerAnglesHint.z
27322732
value: 0
27332733
objectReference: {fileID: 0}
2734+
- target: {fileID: 3652727254930583670, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
2735+
type: 3}
2736+
propertyPath: m_LocalScale.y
2737+
value: 1.8
2738+
objectReference: {fileID: 0}
2739+
- target: {fileID: 3652727254930583670, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
2740+
type: 3}
2741+
propertyPath: m_LocalPosition.z
2742+
value: -2
2743+
objectReference: {fileID: 0}
27342744
- target: {fileID: 4125421792874400280, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
27352745
type: 3}
27362746
propertyPath: m_Name
@@ -3312,6 +3322,16 @@ PrefabInstance:
33123322
propertyPath: m_LocalEulerAnglesHint.z
33133323
value: 0
33143324
objectReference: {fileID: 0}
3325+
- target: {fileID: 3652727254930583670, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
3326+
type: 3}
3327+
propertyPath: m_LocalScale.y
3328+
value: 1.8
3329+
objectReference: {fileID: 0}
3330+
- target: {fileID: 3652727254930583670, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
3331+
type: 3}
3332+
propertyPath: m_LocalPosition.z
3333+
value: -2
3334+
objectReference: {fileID: 0}
33153335
- target: {fileID: 4125421792874400280, guid: 27024f5809f4a4347b9cd7f26a1bdf93,
33163336
type: 3}
33173337
propertyPath: m_Name

Packages/webxr-interactions/Samples~/XRInteractionToolkit/Scenes/WebXRInteractionToolkit.unity

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6912,6 +6912,11 @@ PrefabInstance:
69126912
propertyPath: m_Name
69136913
value: XR Interaction WebXR Setup
69146914
objectReference: {fileID: 0}
6915+
- target: {fileID: 1478900902061109886, guid: 1644f8f6d950f87408375866a875e80d,
6916+
type: 3}
6917+
propertyPath: m_UseGravity
6918+
value: 0
6919+
objectReference: {fileID: 0}
69156920
- target: {fileID: 5773256366622995465, guid: 1644f8f6d950f87408375866a875e80d,
69166921
type: 3}
69176922
propertyPath: m_LocalPosition.x

0 commit comments

Comments
 (0)