Animations - mariusz-tang/KTaNE-Module-Template GitHub Wiki

The two most common ways to make animations are using coroutines and using Unity's animation system.

Coroutines

Using coroutines is the more programmatic method, and is best for making precise animations and/or dynamic animations. They offer per-frame precision over position, speed, and rotation, and are great for making things follows exact trajectories. They also allow you to animate things that may not be animatable using the animation system. The module Coloured Cubes uses coroutines to animate the colours of the cubes, and the shuffling part of the module.

The Update method can also be used similarly to coroutines, but this is usually not recommended because this method runs every frame, even when you might not need it to. The module Orientation Hypercube uses the Update method to animate the vertices of the hypercube, because they are never stationary.

Animation System

The animation system is best used for simple, static animations, where precision is not as important. While the system may seem daunting at first, it is totally worth learning, as it makes creating simple animations easier and more intuitive than coroutines.

The module Technical Keypad uses the animation system for the key presses, and for the opening of its hatch, and the module Silly Slots uses it to animate the lever being pulled.