Procedural animation research

Unity3D -- C#

▚ Project summary:


During this research, I spent more time on understanding procedural animations inside unity.
Full research document: Link

In our group we had some issues where making custom animation would not be a option, besides that in the custom C++ engine we are going to use, custom animations were not prioritized to work. 

I came up with a possible solution, where procedural animations, are an excellent replacement of (our targeted style) robot leg animations.

This page is meant to show my research and conclusions.

The video below, is a video I used as a reference, and also showed my team the video to explain what the finished animations would look like.
this video was made by Justin Cerilli

▌Specifications:

Researched done: January 2021
Project type: School Research
Platform: PC, Windows
Time spent on research: 2 days
Engine and Tools: Unity - C#

▌My contributions:

○ Researching procedural animations in Unity
○ Researching movement using procedural animations, and additional applied translations to the object besides the legs
○ Documenting my research and conclusions

▌Project goals:

○ Learn more about procedural animations and its possible usages inside our intended project.
○ Learn what it takes to make a fully moveable, nice looking object using procedural animations as core animation replacement
○ Document the research

▚ Research phase


The things I learned: 
Inverse kinematics is the mathematical process of calculating the variable joint parameters needed to place the end of a kinematic chain In a given position and orientation relative to the start of the chain. (Wikipedia).
In my own words, inverse kinematics would be the mathematical process of displacing chained bones from the start bone position to the end bone position.

Inverse Kinematics is often used while making procedural animations, especially because the goal of procedural animations is getting non pre-defined bone movement to work.

Inverse Kinematics is definitely needed in our use case of procedural animations. Inverse kinematics support is not easy to make, and there is often already some kind of inverse kinematics support in bigger custom engines (Unity, Unreal).


However, in our project, we would need either custom created inverse kinematics or look into existing C++ inverse kinematics libraries.



I decided to use the FastIK solver for unity¸ After researching this asset in the asset store, and testing the IK solver inside a test project, I was convinced I could make inverse kinematic work with my target model.

The most common way of moving elements/ model parts is to move the attached/rigged bone.

Bone support must be supported in our engine to work with bone related inverse kinematics libraries.

Not supporting bones could be a limiting factor when looking for a C++ inverse kinematics library.

Object displacement is also an example of how to achieve procedural animations.

Raycasting would be a
really nice addition in making height differences work without predefined
height data. In most examples, one of the more exceptional use cases of
procedural animations would be differences in ground heights totally
compatible.

In our case, height could be retrieved from tile data, however this also limits the amount of detail and height difference there could be inside tiles.

Raycast support would require help from the engine team, but would be a usable feature nonetheless.



The video above, made by Codeer explained the needed steps for procedural animation based movement in 9 important steps. 

Listed in a concise list:
1: use inverse kinematics to control the leg from an anchored leg point to a target point.
2: Fix the bottom of the leg to the ground, at the current target position.
3:Parent/attach the target point to the body.
4:Raycast from the target point downwards, to move it to the ground level.
5: Check the distance from the leg position to the current target position (the leg was still targeted at the step 2 target position).
6:Move leg to new target position when certain distance is reached (stepping distance).
7: Put legs into zigzag patterns to achieve normal leg animation look. 
only move leg when opposite leg are grounded.
8: Use average leg position + offset for the body position.
9: rotate body based on the difference between left and right leg height.