Jump to content
  • Advertisement
Sign in to follow this  
davethecross

Voxel Traversal problem

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

Hey Gamedev,

To put it gracefully, I'm trying to draw a line from my character to the nearest tile in the direction he's facing. I found out that this can be achieved with a voxel traversal algorithm. The one I'm using is in this tutorial: http://www.metanetsoftware.com/technique/tutorialB.html near the bottom of the page.

I've attached the pdf of the actual algorithm as well.

Everything has gone fine and I have it running. Once the calculation has finished, the algorithm leaves you with the x and y coordinates of the tile(or voxel) that the line should stop at.

This is all well and good, but I'm missing the final step. What are the final x/y coordinates for the end point of the line that I want to draw? It must be very obvious if they felt like excluding it in the pdf, but I just can't figure it out.

To clarify some possible confusion, I have the x and y of the tile(aka x*tile size,y*tile size will give me the in game coordinates) but I want the x and y of where the line should stop after it hits the tile.

Thanks for reading
Dave

Share this post


Link to post
Share on other sites
Advertisement
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!