From 91c354bc8ebab8c93357e41de49c9ef88203e740 Mon Sep 17 00:00:00 2001 From: Yukihiro Tadokoro Date: Wed, 4 Sep 2024 08:01:05 +0900 Subject: [PATCH 1/2] exclude Passthrough layers from interaction raycasts --- .../Runtime/System/ClientSimInteractiveLayerProvider.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs index a4d20a8..285b075 100644 --- a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs +++ b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using VRC.SDKBase; namespace VRC.SDK3.ClientSim { @@ -16,6 +17,7 @@ public class ClientSimInteractiveLayerProvider : IClientSimInteractiveLayerProvi private const int UI_MENU_LAYER = 12; private const int INTERNAL_UI_LAYER = 19; private const int MIRROR_REFLECTION_LAYER = 18; + private const int FIRST_USER_LAYER = 22; private readonly int _interactiveLayersDefault; private readonly int _interactiveLayersUI; @@ -30,6 +32,8 @@ public ClientSimInteractiveLayerProvider(IClientSimEventDispatcher eventDispatch _interactiveLayersUI = (1 << UI_LAYER) | (1 << UI_MENU_LAYER) | (1 << INTERNAL_UI_LAYER); // When the menu is not open, all layers but UI, UIMenu, and MirrorReflection layers are interactable. _interactiveLayersDefault = ~(1 << MIRROR_REFLECTION_LAYER) & ~_interactiveLayersUI; + // If Interaction Passthrough is set, these User Layers will also be ignored. + _interactiveLayersDefault &= ~(VRC_SceneDescriptor.Instance.interactThruLayers << FIRST_USER_LAYER); _eventDispatcher = eventDispatcher; _eventDispatcher.Subscribe(SetMenuOpen); From d00f8561f07e3df7d502b603a0522fb5a219ad7f Mon Sep 17 00:00:00 2001 From: Yukihiro Tadokoro Date: Wed, 4 Sep 2024 08:44:30 +0900 Subject: [PATCH 2/2] Fix the built-in Passthrough layers to match the client behavior --- .../Runtime/System/ClientSimInteractiveLayerProvider.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs index 285b075..4594530 100644 --- a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs +++ b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs @@ -16,6 +16,7 @@ public class ClientSimInteractiveLayerProvider : IClientSimInteractiveLayerProvi private const int UI_LAYER = 5; private const int UI_MENU_LAYER = 12; private const int INTERNAL_UI_LAYER = 19; + private const int PLAYER_LOCAL_LAYER = 10; private const int MIRROR_REFLECTION_LAYER = 18; private const int FIRST_USER_LAYER = 22; @@ -30,8 +31,8 @@ public ClientSimInteractiveLayerProvider(IClientSimEventDispatcher eventDispatch { // Only the UI and UIMenu layers are interactable when the UI is open. _interactiveLayersUI = (1 << UI_LAYER) | (1 << UI_MENU_LAYER) | (1 << INTERNAL_UI_LAYER); - // When the menu is not open, all layers but UI, UIMenu, and MirrorReflection layers are interactable. - _interactiveLayersDefault = ~(1 << MIRROR_REFLECTION_LAYER) & ~_interactiveLayersUI; + // When the menu is not open, all layers but UI, UIMenu, PlayerLocal, and MirrorReflection layers are interactable. + _interactiveLayersDefault = ~(1 << UI_LAYER) & ~(1 << UI_MENU_LAYER) & ~(1 << PLAYER_LOCAL_LAYER) & ~(1 << MIRROR_REFLECTION_LAYER); // If Interaction Passthrough is set, these User Layers will also be ignored. _interactiveLayersDefault &= ~(VRC_SceneDescriptor.Instance.interactThruLayers << FIRST_USER_LAYER);