Items with no label
3335 Discussions

Using The 'CamAnims' Real-Time Game Animation Technique

MartyG
Honored Contributor III
1,124 Views

Difficulty level: Intermediate. The article assumes a familiarity with creating animation clips on a timeline.

INTRODUCTION

In Fall / Autumn 2017, an exciting new open-world game called 'My Father's Face' is due to be released for PC and Intel Project Alloy "merged reality" headset, with configuration options also included to support comfortable play on other VR headsets such as Oculus and HTC Vive.

Set in a high-gravity alternate world where animals evolved equally with humans and squirrel-people are the dominant species, 'My Father's Face' utilizes real-time 'CamAnims' animation technology three years in the making. CamAnims enables live control of a full-body player character that can move, look around and use its limbs as naturally as a real person.

This means that little tutorial guidance is required, because since the virtual body mirrors the player's own body movements almost 1:1, their life experience informs them how to interact with the game world. Even young children can play alongside an elder family member and feel empowered at the degree of control they have over their virtual representation of themselves.

In this blog article, we will look at how the CamAnims system takes an input value from a control device (motion-tracking camera, keyboard, mouse, joypad, etc) and translates it into a point to jump to on an animation's timeline, enabling real-time forwarding and rewinding along the timeline as control inputs are made.

Although the Unity engine is used for the development of 'My Father's Face', the CamAnims system uses ordinary math calculations that are adaptable to scripting in any engine with a timeline-based animation system so long as you adjust the calculations to reflect the minimum and maximum values used to jump to the start or end point of an animation timeline in a particular engine.

ANIMATION IN THE UNITY ENGINE

In the Unity engine's animation system, animations are configured on a timeline sheet that can played with script instructions from any point on the timeline so long as the value is between '0' (the start of the animation clip) and '1' (the end of the clip). It does not matter if the clip is 3 seconds long or 3000 seconds – it will always have a start point of 0 and an end point of 1.

Usefully, the value of control axis inputs – at least, in the Unity engine – are Ilko usually in the '0' and '1' minimum and maximum range. This makes the inputs perfectly compatible with the scale used by the animation timeline.

On analog joypad inputs, the value moves towards or away from '1' depending on how much analog button pressure is applied, or how far in a certain direction an analog stick is moved.

With digital inputs, the input value usually snaps immediately to the '1' end-value when the button is pressed, although you can set a digital input to increment a value progressively towards a maximum point for as long as that input has a value of '1' (i.e it is being pressed, making its status "true").

In the example below, the depth of the player charactter's crouch towards the ground is controlled by an 'If' logic statement. The crouch position is stored in a variable called 'CrouchDepth', and if the crouch control is pressed (True) then the value of CrouchDepth is incremented or decreased by '0.15' until a maximum value is reached.

if (Input.GetAxis ("Crouch Down") == true) {

CrouchDepth = CrouchDepth + 0.15f;

}

// Ensure that the crouch variable can never be less than 0 or greater than 1

if (Input.GetAxis ("Crouch Up") == true) {

CrouchDepth = CrouchDepth - 0.15f;

}

if (Input.GetAxis ("Crouch Down") > 1) {

CrouchDepth = 1;

}

LINKING THE INPUT VALUE TO THE ANIMATION

Once a variable has been set up to store a particular control input in, we need to link that variable to an object in the project that we wish to influence using an animation clip.

In the Unity engine specifically, objects that need to be controlled with Unity's animation system need to have an 'Animator' component placed inside them. Other game engines may have a different means of animating objects.

The Animator component is configured to look at a particular 'Animation Controller' component, within which animation clips can be stored. It is good practice to group together similar kinds of animation inside Animation Controllers whose name reflects that category of animation (e.g Face_Controller, Arms_Controller, etc).

The Animator...

0 Kudos
0 Replies
Reply