Making a circle - advanced challenge
Legend has it that when the famous painter, Hans Hobein, applied to be court painter to Henry VIII he was interviewed by the King.
The King simply asked him to draw a circle on the ground. He did so, and the circle was so perfect that he got the job. Drawing a circle has always been a test of skill :) |
How to do it
Now you need to get your maths on. You want to work out the x and z positions on the plane of a perfect circle around the origin.
Remember sin and cosine? Remember what they do? You can get Unity to tell you what the sin and cosine of the angle are. The functions you need are: Mathf.Sin(myAngleInRadians) and Mathf.Cos(myAngleInRadians). There's only one problem, it wants the angle in Radians. You may know how to do that, but once again, Unity makes it easy. To get the value of an angle in radians, take your value in degrees and multiply it by Mathf.Deg2Rad Can you do it? It's very satisfying when it works. I promise. |