Exercise 2: Coding Art
My idea was to experiment with blocks that look like legos so I created a preface cube and procedurally generated a grid of these cubes by running a loop which instantiated these cubes again and again. By using each cube's renderer properties, I assigned a random color to each side of it's sides programmatically as well. I applied the lerp transformation to shift between colors of the cube by implementing Coroutine and IEnumerator. In the update function i mapped the X & Y coordinates of mouse move to translate the cubes on their own axis. For experimentation, I also created a sphere and programmatically changed whether it has gravity or not. If you press spacebar, the sphere has gravity and if you press any other button, its useGravity is set to false. The idea was that someone may press space to destroy the random lego world by throwing a giant boulder on it. But interestingly, my sphere falls down really slowly. I programmatically set drag to 0 as well but could not figure out what I was doing wrong. Increasing mass would not have helped as things with higher masses have the same acceleration. I struggled a lot with this exercise but learnt a lot as well. I look forward to learning more code in C# and understanding Unity's physics engine and interactivity in detail. I was not able to execute my boulder destroying the world correctly via C# code but I look forward to implementing more Unity concepts in C#. This is my second code in C# and Unity and the platform is really exciting
Status | Released |
Platforms | HTML5 |
Author | hasankhalid |
Made with | Unity |
Leave a comment
Log in with itch.io to leave a comment.