Mattshark89 / OpenFlight-VRC

MIT License
46 stars 33 forks source link

[BUG] Swimming prefabs can break gravity #46

Closed Happyrobot33 closed 1 year ago

Happyrobot33 commented 1 year ago

Describe the bug Essentially if you fly out of swimming areas, your gravity will never be reset properly, leaving you floating

To Reproduce Steps to reproduce the behavior:

  1. Enter a body of water with a swimming prefab
  2. flap to fly out of the water

Tracked issue The issue is that we record gravity every time you take off to reset back to when you land. When you take off from water prefabs, the water prefab has already set your gravity low, so when we poll it, we get what the water prefabs gravity is, not the true worlds gravity

Potential Fix Change the script setup to save the world gravity once upon loading into the instance, and then always reset to that value. We also need to ensure that there is a way in-editor to re-enable to dynamic gravity feature, and expose a API endpoint to also tell the script to re-grab a gravity value, so world creators can still set gravity without issues if they would like

mackandelius commented 1 year ago

Since it isn't stated I propose to the fix that by default flying should be disabled outright if gravity deviates.

At the very least it should probably be a compatability mode toggle, since we have no way of knowing what a script could be doing with gravity.

atomiklan commented 1 year ago

Thanks Happy for posting.

Happyrobot33 commented 1 year ago

Potential fix in OpenFlight-1.5.2-beta.2

Additional testing still required just to make sure there isn't any weird side affects, and I want to audit it too to make sure it doesn't have any negative impacts on usability

Potential addition is throwing a warning when any other script except openflight scripts modify movement speeds or gravity

Happyrobot33 commented 1 year ago

resolved in latest release, could still use some improvement by hooking into other scripts though