In this quick guide, I will create a rotating coin as collectable bonus in game.
Create a collectable is not so difficult, we have done it before.
To make a collectable more unique, let’s make it spinning in the air.
The key point would only be one thing: find out the local value.
The axis direction would be different between local and global. To make an object rotate by itself, we will need to use the local value.
In this case, we should spin the coin on x-axis.
Open script and add one line in Update().
That would make your coin start spinning as mine. You can also control the spinning speed by using a float variable.
That would be the easiest way to make the gameobject rotating.