• 2D
  • how can I make my player (kinematicbody2d) collide with objects only if needed?

Hello! I'm new to Godot, and I'm a little bit stuck with a problem. I have a set of stairs. And I want my player to generally go back and forth through them, but also be able to climb them if I want to.

I don't really know how to make realistic stairs, so I've just tried to add collisionshapes to them to make them work like slopes. But my player bumps into those collision shapes and gets stuck, can't keep on walking forward. The same thing happens when the player is on the upper platform and needs to go down - it bumps into the lower point of the higher set of stairs and can't keep on walkind down the lower set of stairs.

I thought, maybe I can use collision layers and masks, but I doubt that it can help because the player must find collision in both sets of stairs and, as I understand, the situation with getting stuck would stay the same this way (the player would still collide with all these collision layers).

Maybe I could use some triggers or different kinds of nodes for this? This ladder sits at the beginning of the level, I really want my player not to stuck there and be able to climb these "slopes" if needed :D

This discussion was caught in the moderation queue since you have not confirmed your account yet.

Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.

(Note: You do not need to repost, the discussion has been moved out and is visible now)

If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:

5 days later

You'd probably have to do some custom logic with triggers. Maybe something like an area2d near the flat platforms of the of the stairs that deactivates and reactivates certain collider masks (corresponding to each staircase) on your character when you hit the up or down arrow near them. if you just run past them with left and right the default would be to not have those special colliders active.