- Home /
How to make a 2D stairs you can walk by
Hi, I want to make a 2D stair, that can be walk through, and only walk over it if you "land" on it. I mean if you fall on it, or if you are next to it and just jump and land on it.
Is a regular kind of stairs of 2D But I dont know how to achive this.
I try using Plataform Effector but this dosent work
Here's a image of what I want to achive
There's a lot of 2D using this stairs, now I only can think on room13
Did you try changing rotational offset, or surface arc ? And you could move up bottom edge of stairs collider.
Yes I try changing all the values of the Platfor$$anonymous$$g component, but nothing worked. I try rotating the Platfor$$anonymous$$g, to match the stair collider inclination, and change a lot of values and test. If I can make the player go through the stairs, then I cannot land on them anymore. If I can walk over the stairs, the player cannot walk through them. I tried a lot of different combinations but nothing worked :/
In the stairs Im using a Edge collider 2D a simple line from the bottom to the top
It would help to know what you're doing now and what behavior you're experiencing. Is your character climbing the stairs when they shouldn't be, or falling in front of the stairs when they shouldn't be?
If your game knows when your character is walking versus when your character is falling or jumping, then surely your game can use this information to deter$$anonymous$$e how to interpret a collision with stairs.
Well this is a good idea. Yes the game will use raycast to check if is grounded. Y may use this like OnCollisionEnter(stair) if(playerGrounded) ignorecollision
I had an answer on the forum that I could use trigger in the bottom of the stairs. I gonna try both ways and see which is better
Forum answer: https://forum.unity.com/threads/help-please-how-to-make-a-2d-stairs-you-can-walk-by.498640/#post-3243309
Answer by kikrim · Oct 04, 2017 at 05:56 PM
I tried with moving up bottom edge of collider. This should also work for you. I have different angle of collider, because my character could slide down
link to my video
Ohh that should work, the only problem I see is that when you are walking down a stair, you will fall in the last steps. In the videogames that use this kind of stair that does not happen. I wonder how they achive this :/ Anyway this will work, thanks!
I got a different answer in the forum that may work better. Here's the link: https://forum.unity.com/threads/help-please-how-to-make-a-2d-stairs-you-can-walk-by.498640/#post-3243309