360 degree art suggestion

360 degree art suggestion

Recently I downloaded the wonderful spaceship in 360 degrees. But when trying to use the art work I found it fundamentally flawed. I hope this post will explain what I found wrong with it so future great artwork can be, in my humble opinion, correct.

As a programmer, I wish to calculate the exact ship rotation angle to use and display, I also want to keep track of the minimum amount of information possible to determine this image. I find that the closer I can get my artwork to match the unit circle in terms of degrees the better. For this reason, I only need one value to determine which sprite to display, the heading value.  The heading value will range from 0 to 359.99 degrees and the math involved to determine which image to display works as follows:

Texture.X = ((heading / degrees per rotation) % number of icons per row) * sprite width;

Texture.Y = ((heading / degrees per rotation) / number of icons per row) * sprite.height;

 

The above math works perfectly if the first sprite in the texture is the 0 degree heading and the last sprite in the texture is the 359 degree texture. And then for movement, I just do the following with my same heading value:

Velocity.x = Speed*cos(heading in radians);

Velocity.y = -Speed*sin(heading in radians);

 

So when you design artwork that rotates, I recommend you start at 0 degrees and slowly rotate your artwork counter-clockwise until you reach 360 degrees again. Thanks again for all your efforts, I hope someone found this post informative and useful.

GatorQue