Rotations

Since a 2D sprite is a flat two-dimensional image, it really has the ability to rotate in only one axis: its directional axis. What this means is that if it can move down the Z-axis, rotating it will cause it to spin. Spinning in the Y will cause the sprite to flip, but as it does not have any depth, you would not see it as it flips. The last axis, the X, would act similarly to the Y, but top to bottom. Again, there is nothing to represent a 2D flat object graphically as it flips. We have set up a simple example (Figure 7.1) that may better explain this.

Image

Figure 7.1 Examples of sprite rotation in the three axes

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.