How to setting Maximum altitude setting during that Flying mode

How to setting Maximum altitude setting during that Flying mode!!

I want to set my character doesn’t fly higher than the maximum altitude

A couple of options depending on your game:

  • Have an invisible ceiling which just sits above the world and stops the player from going higher. No real code needed here.
  • On tick check the player height and if it’s above a certain value, don’t allow it to go higher (if you’re using a jetpack or something you could just prevent it from being able to accelerate above a certain height which might feel a little nicer than just a dead stop. This is just a simple check in the player character tick to look at the Z value, compare it against your maximum and then take some action.
1 Like

Oh!! Thank you.
I applied the second method.

No problem. Glad it helped. Can you accept the answer to help others solve their problems too.