Collision Problem.
Asked Answered
C

2

0

So I have a unique problem. I am making a game similar to Geometry Dash and so far I have implemented jumping, auto-scrolling, and part of the first level. I started to implement the death system but here is where our problems begin. I need to make the player collision ignore walls but still land on floors. Why I need to do this is because I have another tiny hit-box inside the cube that kills the player if it touches terrain. This setup looks like this.
I've tried everything I can think of (even one-way collision) over countless hours and none of it has worked. I am still relatively new to Godot, so I'm hoping there is a simple solution to this.

Chinkapin answered 30/10, 2023 at 1:47 Comment(0)
S
0

As I understand it, you might try creating a separate collision layer for walls and floors, set the parent of the outer collision shape's to floors, and the inner to whatever terrain you want to kill the player. If need be, you can dynamically set the collision mask of a collision object using set_collision_mask_value().

Starryeyed answered 30/10, 2023 at 2:14 Comment(0)
C
1

Starryeyed I finally got it working. What I had to do was set two different collision layers for the floor and walls. Then I set the the hit box to be disabled on jump and then I halved the player Hitbox so it doesn’t collide from the side. Thank you for your suggestion.

Chinkapin answered 30/10, 2023 at 21:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.