Rotations and Origins

Posted by Theodore Enderby on Game Development See other posts from Game Development or by Theodore Enderby
Published on 2013-07-12T06:33:21Z Indexed on 2013/11/09 16:16 UTC
Read the original article Hit count: 315

Filed under:
|

I was hoping someone could explain to me, or help me understand, the math behind rotations and origins. I'm working on a little top down space sim and I can rotate my ship just how I want it.

Now, when I get my blasters going it'd be nice if they shared the same rotation.

Here's a picture.

http://weskamouse.net/help.png

and here's some code!

blast.X = ship.X+5;
blast.Y = ship.Y;
blast.RotationAngle = ship.RotationAngle;
blast.Origin = new Vector2(ship.Origin.X,ship.Origin.Y);

I add five so the sprite adds up when facing right. I tried adding five to the blast origin but no go.

Any help is much appreciated

© Game Development or respective owner

Related posts about XNA

Related posts about rotation