# is it possible to generate the walkable area based on an image in a 2D isometric game?

I have hand drawn isometric background looked at about 35-40 degrees.

How to set walkable areas at such image?

Is it possible to use a black ("not white") and white color map sketch and set white areas to be walkable?

Or is there some other way to do it easily?

On this image, black areas represent walls at some height seen at some angle.

I also have more complex maze-like dungeon drawn:

I have searched quite some time but didn't find some satisfactory answer specific to my need.

I suggest that you place invisible "boxes" on the black area and then check for collision. I have drawn a few boxes where you could check for collision.

• What if I have circular ones? Is it possible to automatize the process ? – eon Feb 18 '17 at 16:25
• Btw, @Klemmensen , which boxes do you mean? How to get them in Unity ? – eon Feb 18 '17 at 16:27
• You will have to do it "manually" where you add a box or circle and then you check for collision on it. You can however automate the collision detection by for example making a for loop that checks an array of objects if they collide with the target. – Klemmensen Feb 18 '17 at 16:33
• In Unity, you can use Polygon Collider 2D (or Box Collider 2D if the wall shape isn't a freeform shape). Then assign the collider for a Rigidbody on the playable character. – Rama Alifiandy Feb 18 '17 at 16:43
• Hm, can I draw walls in separate layer in Gimp and import that layer in Unity as image ? Then I would apply Polygon Collider 2D on walls image. I'm sure but this could work. Thank you. – eon Feb 18 '17 at 17:20

Yes, drawing a pixel collision map like that is possible. There are 3 issues tough:

• If the walkable area gets too tight, rounding errors and frame based collision detection will allow players to get into corners they cannot ever get out of again. They get stuck. This is relatively easy to avoid if you keep shapes simple and walking spaces big.

• Pathfinding is trickier the more obstacles there are. with pixel-based collision detection, every pixel is an obstacle.

• You may want people to "slide" alongside walls. This isn't really possible with a pixel based collision map.