How I can check the global Y axis value from the player?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Darko Dark Shadow

Hello, I’m modifying a multiplayer FPS project to learn, but I can’t figure out how to make that when the player reaches or pass a certain height (Y axis) dies. I added a mesh instance (No collision) that is a big sea, so I want to make that when the player falls into the water dies at a specific Y axis value, for example, Y = -25.
Here’s a code in the project that kills the player at a certain distance from the Vector3.ZERO, but it’s not what I want because this code kills the player at a specific distance no matter the axis:

func _process(_delta):
if translation.distance_squared_to(Vector3.ZERO) >= 40000:

I tried to use the node Area but failed, so I think that making the player dies at a certain height is simpler.

:bust_in_silhouette: Reply From: Haydoggo
if translation.y >= 200:

should do the trick

Yes, that work perfect, thank you very much :slight_smile:

Darko Dark Shadow | 2022-07-20 19:19