Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

Algorithm for extending a line toward the end of cell/map

This topic is 3068 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

Hello, I'd like to ask about the algorithm for extending a line (along the edge of the object) to the end of a cell or a node (what you call it) till there is an intersection. This is used for building a navmesh for pathfinding. How can I achieve that? for example


  _____________ <-Extending this line
 |     |
 |     |
 |_____|

Hope this makes sense! Thanks Jack

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Hope this makes sense

Is the edge you want to extend a vector? coordinates? What are the structures for the object and the cell/node?

If you use vectors, for instance:
vector lineBegin = vector(object.topLeft.x, object.topLeft.y);
vector lineEnd = vector(node.rightSide.x, object.topLeft.y);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!