One way collision in 3D?

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

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.

:bust_in_silhouette: Reply From: Magso

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
    platform.get_node("CollisionShape").disabled = true
:bust_in_silhouette: Reply From: super_flo

add a second area below with onAreaEntered(): oneWayGate.add_collision_exception_with(Node)
and remove the exception on_area_exited

Very clean way to do it.

adamscott | 2022-01-20 21:08