Get next X,Y of direction (angle)?
BlitzPlus Forums/BlitzPlus Programming/Get next X,Y of direction (angle)?
| ||
How does one get the next x,y for movement along a hypothetical line the starts at a given x,y but continues in eternity pointing a certain angle from the start x,y? Also, how do I get the angle of two pixels compared to each other (for example the one under left foot and the one under right foot of character) to detirmine proper tilt of character in relation to ground? |
| ||
x = x + cos( angle ) * speed y = y + sin( angle ) * speed angle = atan2( y2 - y1, x2 - x1 ) |
| ||
Ahh you beat me to it....I was looking it up in my forumula book... |
| ||
Thanx. I knew it was something with those mystic cos and tan ;-) |
| ||
Thank you Michael !!! |