Hi,

I had been calculating movement on a 2-d axis a very complicated way that required lots of code, but I recently have come to understand how you can use cos and sin to calculate the movement of X and Y based of a heading (out of 360 deg.)

I'm having trouble implementing it though. The way I was attempting to do it was like this:

Then I realized that the ratios have a pattern (or something like it) every 90 deg. I looked at a nehe tutorial that used this method and it was like this:Code:xShots[count] += sin(shotHeading[count])*0.3f; yShots[count] += cos(shotHeading[count])*0.3f;

Can someone attempt to show me how to do this, or should I just go read a math book?Code:xpos -= (float)sin(heading*piover180) * 0.05f; zpos -= (float)cos(heading*piover180) * 0.05f;

David