Top down game: Wall/Player collision

Hi All,

I’ve googled this and read about 20 posts but can’t seem to find specific answers.

I want to clone the old top down dungeon arcade games such as gauntlet. So when my player runs into a long wall, if the direction held is diagonal, he should just slide smoothly up it. If the direction is directly into the wall he should just stop before the wall.

I’ve tried I think every combination of colliders and rigid bodies and I only seem to get one of two results; a, The player moves through the wall or b, the player jerks against the wall. I’ve also had the player collide with the wall and go into a spin, or the walls shoot off into space, fun times!

I am guessing Unity has nothing built into it for “simple” collision detection as detailed above. If that is the case does anyone know a good sample script to get me started on writing it myself?

Well if old school top down is what you’re going for, it might be easier to side step using the full on physics system, and just go back to good old fashioned bounding box checks yourself. This would better allow you to do a check for “where am i next step if i move, where would i be if a wall was there”.

That should allow you to get around any “shaking” on walls. as for the sliding, only ways i can think of to do that are either separate movement into two separate process for moving along your two axis…axies…axis’s’s you get what i mean. That way the sliding should work. Or when you do your checks for if your going to be in a wall, if you correct that position along the wall normal at that point, it should still then facilitate sliding whilst keeping you out of the wall.

Hope this helps.