So I had that ‘crazy’, out of the world idea to add ramps to my level, how dare I.
But somehow I can’t get it to work, the problem is the collision zone. The same tile ‘ramp up’ mirrored for ‘ramp down’ and I get two different collision polygons
Guess where my player gets stuck, yep, at the left ramp where the collision polygon has that funny step sticking out.
Is that a bug @grazer ? Or am I just plain silly again the way I try to do things?
Anyone has a working ‘walk up and down the ramps’ example?
Hi @TinkerSmith ,
Here’s a few things you can do:
Reduce the friction of both ramps to 0, it will make the player slide much smoothly.
The player should use a Circle Collision Shape not a Polygon (Like your screenshot).
Hey @TinkerSmith - With the Polygon colliders it’s not always intuitive why the vertices end up where they are because the collision geometry is generated (and simplified) using Marching Squares: https://en.wikipedia.org/wiki/Marching_squares
I’ll probably end up making an additional “custom” shape editor to handle edge cases where the veritices need to be exact, but aren’t doing what you expect, but you can usually get the shape you want by tweaking the sprite slightly to make the algorithm happy. The difference here between the left and right is probably caused by floating point rounding if I had to guess.
Anyway - in this case, removing the top pixel causes the generator to start in a better spot. Also I would recommend using a circle collider for the player to get the smoothest possible movement, since colliding polygons against other polygons can run the risk of vertices snagging on each other.
Grazer just about showed it all in that video, but here’s a few other tips.
Longer ramps makes it easier to climb with gravity + friction
1x1 can be finicky, but makes better curves IF it works as intended.
If using a custom hitbox for the stairs, you use an animation to get a better look.
If you use a custom hitbox on the player, try to make a custom hitbox with a circle base,
then use animations for the character.
You can see some ramp ideas in NYCTOPHOBIA, I have a long one at the intro and will later add a scrapped ramp at the end. If you look at the scrapped ramp using the Library, DO NOT use Ctrl + D because the amount from visualizing the polygons can crash your the game (its a big ramp).