Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player not considered underwater even when surface of water is above eye level #2600

Open
John-Leitch opened this issue Feb 25, 2024 · 2 comments

Comments

@John-Leitch
Copy link

Describe the issue

The calculations for when a player begins holding their breath appear to be slightly off. In some cases, the player is not considered underwater even when the surface of the water is above eye level.

To Reproduce

Steps to reproduce the behavior:

  1. Enter a body of water.
  2. Begin to descend.
  3. Observe that breath is not tracked even when the surface of the water is above eye level.

Expected behavior

The player should be considered underwater sooner, probably when eye level is below the surface.

Screenshots and Logs

image

And a little bit further down:

image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 1.0.0
@Jagget
Copy link
Collaborator

Jagget commented Feb 25, 2024

There's one more related issue. When you are on the surface, the green filter still applies, like you're still under water.

  • Enter the water
  • Green filter applies
  • Try to swim up
  • Green filter will not turn off until you're standing on the ground

Screenshot 2024-02-25 172830

@John-Leitch
Copy link
Author

Looking at the code and experimenting with some changes, these appear to be two similar, but distinct issues. The breathing issue is caused by a multiplier of the player y position in PlayerEnterExit.Update, while the underwater issue is caused by a multiplier of the same in UnderwaterFog.UpdateFog. While I haven't tested the fix enough to send a PR out, I believe the breathing problem should be an easy fix.

However, the fog issue is going to be a little more complicated. I tested some changes to the modifier and managed to make the fog present when the player is just below the surface, and gone when above:

image

image

However, when swimming as high as possible, the camera is not entirely above the water.

image

And looking down, the player is able to see into the water with no fog.

image

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

No branches or pull requests

2 participants