Bridge made out of blocks at an angle
Posted
by
Pozzuh
on Game Development
See other posts from Game Development
or by Pozzuh
Published on 2014-07-23T20:59:00Z
Indexed on
2014/08/22
22:36 UTC
Read the original article
Hit count: 271
mathematics
|angles
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.
© Game Development or respective owner