0 votes

Hi everyone. I'm triying to achieve some kind of one way collision for a platformer 3D game without sucess. Now I'm experimenting with areas but it doesn't seems like a proper way to do it. Any ideas? Can't find nothing related to 3D.
Thanks in advance.

in Engine by (21 points)

2 Answers

0 votes
Best answer

You can toggle the CollisionShape's disabled property when the player is above or below it, for example.

if player.global_transform.origin.y > platform.global_transform.origin.y + half_of_player_height: #Add more if the origin of the player is centred.
    platform.get_node("CollisionShape").disabled = false
else:
    platform.get_node("CollisionShape").disabled = true
by (3,225 points)
selected by
0 votes

add a second area below with onAreaEntered(): oneWayGate.addcollisionexceptionwith(Node)
and remove the exception on
area_exited

by (14 points)
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 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 webmaster@godotengine.org with your username.