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 (77 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,259 points)
selected by
+1 vote

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

by (16 points)

Very clean way to do it.

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.