I’d like to able to map an area using raycasting.
I want to use it to find all dead ends, turns and exits of a place(like a building or a maze)
I know if I want to exit it I can just use NavMesh, but the reason I’d like to do it this way is so I can wisely select a path which avoids certain things (like enemies)
I know some people would already suggest to make the enemies obstacles but it won’t be all that good for two reasons:
- I only want the target to avoid them, not all other agents, and certainly not them from themselves
- I don’t just want the target not to touch them, I want the target to run away from them.
The way I thought of mapping a place with raycasting is the following(Image)
Blue dot - you
Black line - wall
Arrows - raycasting
The red arrows are the first raycasting, orange second, yellow third etc. (Recurring task)
the image also displays the two problems I think I’d encounter trying to do so.
Problem 1) Overmapping, I overmapped in the drawing by purpose, most of the arrows are not even needed as the map as already fully revealed, how can I tell when I already mapped it all?
Problem 2) Dead end mapping, the pink arrows are arrows that lead straight to a wall.
There is no need at all to make them, infact, making them will make this method infinite because you can always continue, so I need to know how to avoid making those arrows.
thought it’d be easy, but then another thought and I realized that it isn’t that easy…
I mean just because the distance is short doesn’t mean it’s a dead end, and it can still be raycasted properly, I don’t really know how I can tell the system to avoid it.
Could you please help me think of a way to solve those problems, make your opinion about my solution and perhaps even suggest me with ideas I haven’t thought of?
Appreciating your comments