Animating in Unity

Animations give things life and can often give personality to characters, but in this project, I am using them for funtionality to simulate natural distasters and give a tour of the world build.

In this first screenshot, you can see a diagram-like workflow set of instructions, this is the animator in Unity, these set of instructions include the idle animation, and all other animations that I want to include in gameplay. I can select which one I would like to switch to by using a script coded in c#.

This script simply states once a button is pressed, search for the animation named "Quake" and execute it. I have done this 4 other scripts for each hotkey 1 - 4. The code under void start(){} asigns the word "anim" to get information from the animator, allowing me to refer to it and use animations within code.

Refering this to my project, I can use a keyboard to gamepad application, and I have redirected these 1 - 4 numbers to buttons 1, 2, a and b on the wii remote, this allows players to play the game with a wii remote, making it more accessable and a bit more fun to use.

Within this screenshot, you can see the actual animation information of the locations stated in x, y and z, the rotations and scale. In this specific animation, I have stated the location and rotational values to the camera, to move the camera around on the press of a button as it can do due to the hotkey 1 being assigned to this animation in the animator.

This screenshot shows the animation being executed. As I have asigned this to the camera this alters the location and rotational values of the camera.

This script simulates earth spinning as an animation. I have done this instead of creating an animation and refering to it in the animtor becuase in my experience it is much easier to do this, which allows easy looping and continuity.By attaching this script to my earth, I can make it spin in a value I have stated.

In my world building blog I had said that I have made it so the trees and moon rotate with the earth. How I do that is because of this script. I can make the trees and the mood childs of the earth, this means they will follow any movement the earth makes.