2
$\begingroup$

If I had a position of 0,0 and I had an angle of 45 degrees (or any number) and my velocity was 1 what would be the x,y increase?

For example if I had a 90 degree angle, and I had a velocity of 1. Then because my angle is straight up, my increase would be 1y and 0x.

Not sure if this makes sense, I am programming a small game, that shoots on any angle, and I need to pass it x and y coordinates so it shoots on the same angle.

Thanks!

Just need the equation, or a tutorial

1 Answers 1

0

From $(0,0)$ at angle $\theta$ at velocity $1$ you get to $x=\cos\theta$, $y=\sin\theta$. You know trigonometry?

  • 0
    used to! so if I had an angle of 45 it would just be x=cos45 and y=sin45 seems pretty straight forward. So x=0.707 and y = 12011-06-27
  • 0
    @Johnny, yes.$ $2011-06-27
  • 1
    @Johnny - $x$ looks fine by $y $ does not, as you should find $\cos 45 = \sin 45 = 1/\sqrt{2} \approx 0.707$2011-06-27
  • 0
    oops, you are right, I did tan. is Y always going to be sin? If so why is that?2011-06-27
  • 1
    It is the definition of the sine as opposite/hypotenuse. Since your angle is measured from the $X$ axis, $v_x=v \cos(\theta), v_y=v \sin (\theta)$2011-06-27
  • 0
    When I wrote "yes" above, it was to the $x=\cos45^\circ$, $y=\sin45^\circ$, not to the $x=0.707$, $y=1$ (which I didn't see at the time, perhaps it wasn't there at the time).2011-06-27