Skip to content

Feature/station workaround#8

Open
Fallendea wants to merge 5 commits intoSylanTroh:devfrom
Fallendea:feature/station-workaround
Open

Feature/station workaround#8
Fallendea wants to merge 5 commits intoSylanTroh:devfrom
Fallendea:feature/station-workaround

Conversation

@Fallendea
Copy link
Copy Markdown

@Fallendea Fallendea commented Apr 4, 2026

Hi~

I implemented an optional workaround for the station problem. CapoLock did message u about that already once.
Feel free to contact me via Discord - name is the same. Or message Capo.
Never did a VrChat/Unity package, just scripts I sent the people directly. So if I missed something - or for example all these changed assets are not necessary - let me know.

About the workaround.
As u already know, the Problem is that the PlayerCollider is deactivated when entering a station. Without the collider, OnPlayerTriggerEnter/Exit will never happen.
At the same time we dont have a 100% guaranteed way to detecting a player entering a avatar station.
Even worse, when leaving the Station the "OnPlayerTriggerEnter" will happen, but when entering a Station, OnPlayerTriggerExit wont be called.

Best case szenario:
Nothing happens at all when u are in a station and get carried throgh AudioZoneColliders. U will just no longer be able to hear the one carrying u (and maybe others), since u are stuck in a differen zone.

Worst case szenario:
U were already in a zone and exit it while being in a station. Now the AudioManager will have u forever in that zone and only a rejoin will fix it.

The Workaround adds a follower with a collider and rigidbody.
-This follower is local only. Nothing gets synced
-This follower has an Editor script to configure collider/rigidbody automatically
-This follower will be updated every X seconds (configureable, 0.1 seems fine and saves some performance)
-This follower will detect collision (OnTriggerEnter, OnTriggerExit) only with layer "AudioZone" and will then get the AudioZoneCollider from that to call OnLocalPlayerEnterStationFix or OnLocalPlayerExitStationFix with a slight delay.

AudioZoneCollider got updated with these new functions.
It will do nothing when u entered/exited through normal means (OnPlayerTriggerEnter/Exit).
Otherwise it will send a CustomNetworkEvent to everyone with the local player id. Every client then gets the Player for that id and handles the normal "Player entered/exited AudioZoneCollider"-case.
It will know what to do based on a counter that gets incremented on enter and decremented on exit. This counter is also important when exiting an AudioZoneCollider - see edge case below.

As u know, the AudioManager keeps track of the audio zones by incrementing/decrementing a counter for that AudioZoneId.
This means, if u enter the Zone normally it goes from 0 -> 1, but if u then enter a station and leave the zone, it would be stuck at 1. If u enter again normally it goes from 1 -> 2 and on leaving normally it goes from 2 -> 1, u will be stuck forever.
The Workaround will fix this already, but there is an edge case:
When u enter and leave a station inside of an Audio zone, u always increment the counter more. Lets say u reached a counter of 8. When u then leave normally, it will only decrease the counter by one. In this case the workaround have to decrease the counter for the remaining 7 to reach the 0.

AudioManager was changed to allow decreasing by more than 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant