Documentation/Articles/Overview of Animation System

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level

Contents

Description

Animation system is a unified system of the engine used for animation adjustment.

In order to adjust animation you have to configure an .animationTree file for each model you are going to animate. This file contains a hierarchical structure, which is known as animation tree. In Object Type Editor you have to attach a model, that will use this animation tree file for animation.

Programmers can configure various effects on animation trees using the code.


For better understanding of the animation tree system you can view this video, which demonstrates similar file format from other developers. You can also read more about this format on this link.

The screenshot demonstrates a Robot.type file opened with Game Object Editor. You can see that the selected attached model has an AnimationTree property which refers to the animation tree file.

AnimationTree.jpg

.animationTree File Format

Unfortunately, Animation Tree Editor has not been developed, yet. Thus, you can only create animation tree files manually using a text editor. There is a specific file format used for configurating animations, which we will be dealing with below. Files of this format have the .animationTree extension.

As a simple example, let us examine the Robot.animationTree file, which is stored in the Data\Types\Units\Robot\ folder of the SDK.

blocks
{
	block Output
	{
		uin = 1
		in = 100
	}
 
	/////////////////////////////////////////////
	//Attack trigger
 
	block Trigger
	{
		uin = 100
		triggerName = "fire"
		off = 200
		on = 101
	}
 
	block Animation
	{
		uin = 101
		animationName = "attack"
		speed = 1
	}
 
	/////////////////////////////////////////////
	//Select walk or idle
 
	block Transition
	{
		uin = 200
 
		selectedIndexSource = 201
		animation0 = 400 // go to idle animation
		animation1 = 310 // go to walk
	}
 
	block Parameter
	{
		uin = 201
		parameterName = "move"
		value = 0
	}
 
	/////////////////////////////////////////////
	//Walk
 
	block Direction8Sides
	{
		uin = 310
 
		angleSource = 311
		speedMultiplierSource = 316
 
		forward = 312
		backward = 315
		left = 312
		right = 312
		forwardLeft = 312
		forwardRight = 312
		backwardLeft = 315
		backwardRight = 315
	}
 
	block Parameter
	{
		uin = 311
		parameterName = "moveAngle"
		value = 0
	}
 
	block Parameter
	{
		uin = 316
		parameterName = "moveSpeed"
		value = 1
	}
 
	block Animation
	{
		uin = 312
		animationName = "walkAgressive"
		speed = 0.6
	}
 
	block Animation
	{
		uin = 315
		animationName = "walkAgressive"
		speed = -0.6
	}
 
	/////////////////////////////////////////////
	//Idle
 
	block Animation
	{
		uin = 400
		animationName = "idleAgressive"
		speed = 1
	}
 
	/////////////////////////////////////////////
 
}

You can see that animation tree is a text file in the standard NeoAxis TextBlock format. The file contains a list of blocks connected to each other. Each block has its own type and a unique uin identifier. Blocks are connected in such a way that Output block is always the root block.

For better understanding of the animation tree system you can view this video, which demonstrates similar file format from other developers. You can also read more about this format on this link.


Below we will be dealing with blocks in detail.

Output block

This block is used for output of the entire animation tree. Being a root block, there can only be one block of this type in each animation tree.

Parameter Name Parameter Type Description
in Link to block An animation source that the whole animation tree will be resulting in.

AnimationSource block

Source animation. This block plays a single animation at a specified speed.

Parameter Name Parameter Type Description
animationName String Animation name.
speedSource Link to block Source of animation speed value. This block will receive animation speed value from another block, which is specified in this parameter.
speed Value Animation speed. If the speedSource parameter is specified', this parameter will be ignored.

Blend block

Animation blending block. This block selects two adjacent animation from the list and blends them. Animations are selected according to their weight, which always stays in the range from 0 to 1. This block always contains at least 2 animations. In this case, a higher value of the "weight" parameter increases weight of the second animation. In case there are more than two animations, weight will be applied to the last two animations. For example, if a block contains 4 animations and weight value is about 1, the engine will blend the last two animations.

Parameter Name Parameter Type Description
animation0, animation1, ..., animation {N} Link to block Sources of animations.
weightSource Link to block Source of weight value.
weightValue Value Weight value. If the weightSource parameter is specified, this parameter will be ignored .

Parameter block

This block returns a value, which can be used as an input parameter by other blocks.

Programmers can change the value of this block from code using its name.

Parameter Name Parameter Type Description
parameterName String Parameter name.
value Value The current value or a default value.

Sum block

Use this block to sum several animations.

Example: If a character has separate animation for torso and legs, you can use this block to perform final blending of these animations.

Parameter Name Parameter Type Description
animation0, animation1, ..., animation {N} Link to block Sources of animations.

Transition block

This block contains a list of sources of animations and chooses one of the sources by its Index. The index is an integer value.

Example: A character may be in one of the three states: standing, sitting, lying down. So, the Animation0 parameter will refer to the "standing" animation, the animation1 parameter will refer to the "sitting" animation, and the animation2 parameter will refer to the "lying" animation. Depending on the value of the index (0, 1, 2), the character will appear standing, sitting or lying.

If you change the index, the block will smoothly blend the old and the new value. To do this, you have to specify the transition time parameter. By default, the transition time is equal to 0.2 seconds.

Parameter Name Parameter Type Description
animation0, animation1, ..., animation {N} Link to block Sources of animations.
selectedIndexSource Link to block Source of index value.
selectedIndex Value Index value. If the selectedIndexSource parameter is specified, this parameter will beignored.
transitionTimeSource Link to block Source of transition time value.
transitionTime Value Transition time value. If the transitionTimeSource parameter is specified, this parameter will be ignored.

Trigger block

This block is a switch. The block can be either in an active or an inactive state. In the inactive state this block returns the output value: off. When activated, this block returns the output value: on. This block automatically turns off, when the animation of the on parameter ends.

A typical use of this block is for jump animation of a character. When the character jumps, all animations have to be interrupted with the "jump" animation played instead. On jump this block is activated. Once the block is activated, it will return the output value: on. The on parameter has to refer to a "jump" animation.

Programmers can activate this block from code, addressing it by name.

When the switch is triggered, the block may also smoothly blend the values of parameters off and on. To do this, you have to specify the transition time. By default, the transition time is equal to 0.2 seconds.

Parameter Name Parameter Type Description
triggerName String Name of the switch.
off Link to block Source, when the unit is turned off.
on Link to block Source, when the unit is turned on.
transitionTimeBlock Link to block Source of the transition time value
transitionTime Value Transition time value. If the transitionTimeBlock parameter is specified, this parameter will be ignored.

Direction8Sides block

This block is similar to the Transition block, with the only exception that the Index is determined by the angle. This block is useful for animating character legs, in particular when you need to create animations for character movement. This block supports up to 8 directions. You can also engage less directions (e.g. four of less).

If you change the angle, the block will smoothly blend old and new values. To do this, you have to specify the transition time. By default, the transition time is equal to 0.2 seconds.

You can also specify animation speed multiplier for this block.

Parameter Name Parameter Type Description
forward, forwardLeft, forwardRight, left, right, backward, backwardLeft, backwardRight Link to block Sources of animations.
angleSource Link to block Source of angle values.
angle Value Angle value. If the angleSource parameter is specified, this parameter will be ignored.
speedMultiplierSource Link to block Source of speed multiplier value.
speedMultiplier Value Speed multiplier value. If the speedMultiplierSource parameter is specified, this parameter will be ignored.
transitionTimeSource Link to block Source of transition time value.
transitionTime Value Transition time value. If the transitionTimeSource parameter is specified, this parameter will be ignored.

LookAt block

This block is similar to the Transition block , with the exception that the Index is determined by two angles: horizontal and vertical. This block is useful for animating how your character looks around. The block supports up to 9 directions. The block can engage less directions as well (e.g. four directions of less).

If you change angles, the block can smoothly blend the values of the old and the new directions. To do this, you have to specify the rate for both horizontal and vertical angle. By default, the transition rate is set to zero, which means that the transition is implemented immediately.

You can also specify animation speed multiplier for this block.

Parameter Name Parameter Type Description
leftUp, leftCenter, leftDown, centerUp, centerCenter, centerDown, rightUp, rightCenter, rightDown Link to block Sources of animations.
horizontalAngleSource Link to block Source of horizontal angle value.
horizontalAngle Value Value of horizontal angle. If the horizontalAngleSource parameter is specified, this parameter will be ignored.
verticalAngleSource Link to block Source of vertical angle value.
verticalAngle Value Value of vertical angle. If the verticalAngleSource parameter is specified, this parameter will be ignored.
speedMultiplierSource Link to block Source of speed multiplier value.
speedMultiplier Value Speed multiplier value. If the speedMultiplierSource parameter is specified, this parameter will be ignored.
horizontalAngleSpeedSource Link to block Source of horizontal angle change speed value.
horizontalAngleSpeed Value Value of horizontal angle change speed. If the horizontalAngleSpeedSource parameter is specified, this parameter will be ignored.
verticalAngleSpeedSource Link to block Source of vertical angle change speed value.
verticalAngleSpeed Value Value of vertical angle change speed. If the verticalAngleSpeedSource parameter is specified, this parameter will be ignored.