Jump to content
  • Advertisement
lucky6969b

3D How is it possible to locate pavement area of the roads in the scene?

This topic is 455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Upon building a grid on the scene, how do I identity the pavement area of the road, if I build a grid on it, the grid cells will cover the center of the road plus the pavement, as in road network pathfinding, I need to separate them and treat pavement as blockers....

thanks

Jack

Share this post


Link to post
Share on other sites
Advertisement

I don't know if this is the correct way to do it, but maybe use an octree of the grid to check to see if an object is within the current grid, for a object with that a certain material, or identifier. If so, divide that grid by half and check both the smaller boxes. After narrowing it down enough, then use ray-testing.

Share this post


Link to post
Share on other sites

Are you talking about excluding the road from a search area? Say like excluding it from the Open List of an algorithm like A*. If so I'm assuming you already have some internal structure representing Tiles. You could expound on this by adding an enumeration for type. like, uh, say

enum tile_type { ROAD, SIDE_WALK, DIRT, ECT };

And than just conditionally parse through your tiles come search time and omit the tiles you don't want in the proposed search area.

Share this post


Link to post
Share on other sites

haha, manually tagging each one would be a pain for a large map. When you initially create your tiles, loop through them, and assign the respective tile type. So let's say, a trivial example, I'm utilizing an array for my data set for tile creation. 0 = side_walk, and 1 = road

like so:

int map [] = { 000000111000000
 			   000000111000000
			   000000111000000
			   000000111000000
			   000000111000000
			   000000111000000 };

You may be using a different data set for your map creation, an image, a text file, whatever, but the key is to know what data you're working with to generate your tiles, and to give it meaning within your application.

So with the above example, since I've denoted 0 = side_walk, and 1 = road. I can loop through my dataset, and create my tiles with those appropriate types in mind

like so:

for (int i = 0; i < MY_ARRAY_SIZE; i++) 
{
	if (map == 0) myMapVector.push_back(new Tile(SIDE_WALK));
    if (map == 1) myMapVector.push_back(new Tile(ROAD));
}

 

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!