- Home /
Glide along edges and auto-jump (cube-based)
Hi all,
I've got a procedurally generated map based on 3d cubes and half cubes. Together they form straight and diagonal walls. You can think of it like the maps in Golden Sun (though I'm assuming they "faked" the 3d aspect):
Now, there's a couple of behaviours I'd want:
When the player walks into a wall, they stop/slide if diagonal
When the player walks along an edge, they stop/slide if diagonal
When the player walks into an edge, and there's another edge one cube opposite - or a game object to stand on (such as a crate or pillar) - they jump there
I've already tried the following, but am running into issues:
Automatically generating a collider, by injecting a cube or half cube for every coordinate. Sliding then automatically happens, because my player collider is a capsule.
Cliff collision works by also injecting a collider if a coordinate is empty and empty below it as well.
Jump detection then checks if there's a gap and cliff in the direction I'm moving in. Also works.
However:This breaks "standing on crates and pillars", because basically all whitespace in my map is now a collider.
Some people advocate raycasting down from the players' edge to detected edges, but I expect that would break "sliding" along diagonal edges.
Long story short: how is this commonly done in game dev? I'm sure the combination of collision for edges and auto-jumping is common enough for people with more experience than me to share some light on.
Thanks!
$$anonymous$$ore $$anonymous$$ountains has a TopDown Engine that might be worth a try if you want to look at general useful patterns.
Thanks, @jphilipp, I’ll be sure to take a look at that :)
Your answer
Follow this Question
Related Questions
Box Colliders Merging 0 Answers
Jumping on top of an enemy problem 1 Answer
How do I get rid of white lines when objects collide? 1 Answer
GameObject Colliding with Object Edges 0 Answers
Falling Objects Sound 1 Answer