# Path finding in the 3D environment

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

## Recommended Posts

Hello for every one... I search in the internet about path finding i saw alot of but... Is there any essays or help about how can i apply the path Finding in the 3D environment. For example :- In the first person shooter if i was in the second floor on the Building and the enemy saw me so how can lift to the second Floor (there is a stair nearby him) by using the path Finding ???? Is there any approch ? can i design a 3d matrices to get the Solution for this problem ??? Thanks for any information

##### Share on other sites
You can use pathfind algorithm to find the path. Such as A* (A-star).
But repsentin the 3D world to the pathfinder is trickier part where i need help too so hopefully some one else can glarify how it works.

##### Share on other sites
You represent it as a graph. =)

##### Share on other sites
Quote:
 Original post by xorYou represent it as a graph. =)

Think I knew that...

##### Share on other sites
If you want to keep it simple, build a graph of nodes by hand, and connect them by hand.

If you're not fluent with the graph terminology, think of nodes as "intersections or turnings" and edges as "street segments".

From that, think as if you were in a multi level parking lot.

Say you're on the first floor, and want to reach a parking place right where you are, but on the third floor. What you would do, is find the combination of "straight segments" and "turnings" that's the most optimal to reach that exact position. Since you can't "fly" from a level to the other, there is no "segment" that goes straight from your position to the one on the third floor, you'll most likely search for a ramp and use that, and once on the second floor you'll search for a ramp to the 3rd floor, and from that, a combination of segments and turnings until you reach the desired position.

Since the segments are the only way to reach nodes, your A* search will give you a valid path, using ramps else than trying to go in straight line on the next level.

I hope my English was clear enough and that I didn't over simplify.

The 3D matrices are not really related to pathfinding, you'd better look for graph searches.

So anyway, that was a brief explanation of how to "search a path".

Now, try to search for A star implementations (check out James Matthew's website, especially, try to find his A* explorer, it ships with full source code, this might be helpful to you). Don't be fooled though, A* isn't the only solution around, but it's the one that will always return you the most optimal path.

Cheers

Eric

##### Share on other sites
Thanks xEricx and thanks for all

Thanks for all

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 31
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015618
×