From 0204e70c2b520b2b193b7bdf11c39e51e8b46069 Mon Sep 17 00:00:00 2001 From: Matthew Herber Date: Mon, 23 Sep 2024 21:59:31 -0400 Subject: [PATCH] add workaround for main menu change that happened --- .../Runtime/Scripts/Flight/WingFlightPlusGlide.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/com.mattshark.openflight/Runtime/Scripts/Flight/WingFlightPlusGlide.cs b/Packages/com.mattshark.openflight/Runtime/Scripts/Flight/WingFlightPlusGlide.cs index 1373de4a..84f71002 100644 --- a/Packages/com.mattshark.openflight/Runtime/Scripts/Flight/WingFlightPlusGlide.cs +++ b/Packages/com.mattshark.openflight/Runtime/Scripts/Flight/WingFlightPlusGlide.cs @@ -779,7 +779,8 @@ private bool IsMainMenuOpen() const int layer = 2 << 18; //swapped from OverlapSphere to OverlapSphereNonAlloc, as it does not allocate memory each time it is called, //saving on garbage collection. Also doesnt require a .Length check, as it returns the number of colliders it found inherently. - int uiColliderCount = Physics.OverlapSphereNonAlloc(LocalPlayer.GetPosition(), 10f, _colliders, layer); + //Second note, instead of using localplayer position, we use the head position, as the player position can desync depending on Holoport and VRC changes. + int uiColliderCount = Physics.OverlapSphereNonAlloc(LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).position, 10f, _colliders, layer); //commented out due to extern count, this uses 3 //return uiColliderCount == 8 || uiColliderCount == 9 || uiColliderCount == 10;