Hello, ok I'm just going over game basics to get the hang of it again.
I know I have asked a question like this before, but this is slightly different in that I would like to find out how to derive direction formula based on sprite position.
I have a 2d spaceship:
I was using the one the right initially, but then I was messing with the rotation when I decided to use the one on the left.
To calculate the direction (velocity) vector based on that right sprite position I used this formula,
playerVel.X = Math.Sin(rotAngle) ;
playerVel.Y = -Math.Cos(rotAngle) ;
That worked fine, until I let the sprite's initial position look like that of the left. To calculate the direction I was guessing the formula..until I tried the original formula of finding direction based on angle of rotation. The one that makes sense.
playerVel.X = Math.Cos(rotAngle);
playerVel.Y = Math.Sin(rotAngle) ;
now this makes sense! Cos is used to find the X value and Sin to find the Y value. My question is, how does switching how the sprite's initial direction in a 2d image change the formula to find the new direction vector?
If I knew how to plot this on a graph paper I'd be able to derive the formula instead of guessing..I was never good at trigonometry so can someone please make this clear using some pictures of a graph or something..hopefully?
Thanks
NOTE:
Before Salem gets super angry (or anyone), I posted this on the gamedev.net last night..but they're not particularly helpful.
btw: I like the new attachment system. Easy on the user.