Bridge made out of blocks at an angle
- by Pozzuh
I'm having a bit of trouble with the math behind my project.
I want the player to be able to select 2 points (vectors). With these 2 points a floor should be created. When these points are parallel to the x-axis it's easy, just calculate the amount of blocks needed by a simple division, loop through that amount (in x and y) and keep increasing the coordinate by the size of that block.
The trouble starts when the 2 vectors aren't parallel to an axis, for example at an angle of 45 degrees.
How do I handle the math behind this?
If I wasn't completely clear, I made this awesome drawing in paint to demonstrate what I want to achieve. The 2 red dots would be the player selected locations. (The blocks indeed aren't square.) http://i.imgur.com/pzhFMEs.png.