In this tutorial we will look over how to make a 3D object rotate on a axis.
We are going to look over two methods which can be used to make a 3D object rotate
Method1:-
Using update method in C#
First we need to add the Gem as a game object, which can be found from Asset store for free. Then we have to write click to create a C# script and name it to "Rotate" after that drag and drop that script onto the gem game object. Then after that you can double-click the empty script and add the code for making the gem to rotate .

After saving the script you can go back to unity and go to game and play then you can you see that the gem is rotating smoothly.
Method2:-
Using unity animation tool
Select gem and to animation then create a folder and name it as gem and rotate
After that select transform and rotate where we can change even change the values of the axis we want to as we prefer.
Here animation will not be very smooth and it will be very jittery. We have to adjust the curves and we can change the blue curve and try to make it a straight curve as it represents z-axis and try to delete yellow and red curves as they represent x and y axis
After this we can now see that gem is rotating smoothly without any issues.
Manav Singh(20BCG10020)
VIT Bhopal, CSE Game Design