Skip to content

Commit 9cb6d71

Browse files
Merge pull request #120 from nemu90kWw/fix-interaction-block-layers
Fix Interaction Passthrough layers to match the client behavior
2 parents 835a346 + d00f856 commit 9cb6d71

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Packages/com.vrchat.ClientSim/Runtime/System/ClientSimInteractiveLayerProvider.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using UnityEngine;
3+
using VRC.SDKBase;
34

45
namespace VRC.SDK3.ClientSim
56
{
@@ -15,7 +16,9 @@ public class ClientSimInteractiveLayerProvider : IClientSimInteractiveLayerProvi
1516
private const int UI_LAYER = 5;
1617
private const int UI_MENU_LAYER = 12;
1718
private const int INTERNAL_UI_LAYER = 19;
19+
private const int PLAYER_LOCAL_LAYER = 10;
1820
private const int MIRROR_REFLECTION_LAYER = 18;
21+
private const int FIRST_USER_LAYER = 22;
1922

2023
private readonly int _interactiveLayersDefault;
2124
private readonly int _interactiveLayersUI;
@@ -28,8 +31,10 @@ public ClientSimInteractiveLayerProvider(IClientSimEventDispatcher eventDispatch
2831
{
2932
// Only the UI and UIMenu layers are interactable when the UI is open.
3033
_interactiveLayersUI = (1 << UI_LAYER) | (1 << UI_MENU_LAYER) | (1 << INTERNAL_UI_LAYER);
31-
// When the menu is not open, all layers but UI, UIMenu, and MirrorReflection layers are interactable.
32-
_interactiveLayersDefault = ~(1 << MIRROR_REFLECTION_LAYER) & ~_interactiveLayersUI;
34+
// When the menu is not open, all layers but UI, UIMenu, PlayerLocal, and MirrorReflection layers are interactable.
35+
_interactiveLayersDefault = ~(1 << UI_LAYER) & ~(1 << UI_MENU_LAYER) & ~(1 << PLAYER_LOCAL_LAYER) & ~(1 << MIRROR_REFLECTION_LAYER);
36+
// If Interaction Passthrough is set, these User Layers will also be ignored.
37+
_interactiveLayersDefault &= ~(VRC_SceneDescriptor.Instance.interactThruLayers << FIRST_USER_LAYER);
3338

3439
_eventDispatcher = eventDispatcher;
3540
_eventDispatcher.Subscribe<ClientSimMenuStateChangedEvent>(SetMenuOpen);

0 commit comments

Comments
 (0)