In this Unity tutorial we learned how to utilise the programming language C# in our games to rotate the arms on a clock that we've made in the Unity Editor.
The tutorial was on this page and it was relatively easy to read through and follow. I started from the start in building the clock face out of a 3D Object in game. In this case I used a cylinder. I flattened the cylinder to create a face and moved on to making the hour indicators. For this I had to use a cube 3D Object, and make it long and narrow. I then learned how to use the hierarchy system in the Unity editor to make multiples of the hour indicator. Each time I duplicated one I had to increase it's y rotation by 30 degrees to move it along the clock face's axis. These indicators were then taken from their 'parents' in the hierarchy system and placed as 'children' under the clock object.
Moving on I created the arms next, making each of them a parent of their own for the hour, minute and seconds arms. They all were made different sizes and their rotations started them at the 12th hour on the clock. Now it was time to animate them, and this is where it gets challenging.
This is where we begin to use C# script in Microsoft Visual Studio, and it links in to Unity and updates as we save it. This took a while and a lot of making sure that the code was entered correctly (much like with our Web Development module). To finally get the clock moving was a great feeling and I'm glad I know some of the basics in animating objects in Unity. I know this will help a lot towards my game further down the line.
My Clock a little over halfway into making it |
Comments
Post a Comment