The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

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.distancesquaredto(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.

Godot version 3.4.4
in Engine by (15 points)

1 Answer

0 votes
Best answer
if translation.y >= 200:

should do the trick

by (132 points)
selected by

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.