I am making a small driving game for my friends just for fun. There are a few streets in my map which the player can drive the car around. I am trying to find a way to display the street name that the player is currently driving on.(Like in GTA IV/GTA V). And I also need to display the main region. What can I do to let the game detect which street/area the player is in?
- Define trigger boxes for every area which belongs to a certain street and change the current street name when the player enters any of these boxes
- Lay out lines in the middle of the streets and check which line is nearest to the players position and use that line as the current street
- Use AABBs and then basically the same as with the lines (which box is nearest to the player, use that box as the current street). Has the advantage that you can model the volume of actual streets better than with lines
I hope this inspires you for a more specifically suited solution, if you got questions to any of these proposals just ask! The AABB / Line approach probably will involve some editor scripting, gizmo drawing at least.