Animation System
A procedural system that makes creating smooth and fluid animations easier than ever.
The Procedural Animation System is designed to enable the creation of various animation types dynamically. While it’s not intended for complex sequences like full reload animations, it's perfect for procedural movements such as sprinting, walking, jumping, aiming, crouching, and camera motion.
The system is built around two core components:
ProceduralAnimator This component manages all procedural animations, calculates their combined effects, and applies the final results to the target object or transform.
ProceduralAnimation Each animation behaves independently, calculating its own values based on internal logic and modifiers. These values are then passed to the ProceduralAnimator for blending and application.
Together, these components provide a flexible and efficient way to animate objects procedurally in real-time.
Creating An Animator
To begin using the procedural animation system, attach the ProceduralAnimator component to the object you wish to animate. This component will manage and control all procedural animations for that object.

Procedural Animator Fields
Animations Holder
A GameObject that contains all animations.
Weight
The extent to which the final position and rotation of each animation is influenced.
Position Weight
The extent to which the final position of each animation is influenced.
Rotation Weight
The extent to which the final rotation of each animation is influenced.
The animator requires a game object that holds all the animations as children. This game object is referred to in the Animator as the "Animations Holder." To set it up, create an empty game object as a child of the object you want to animate and assign it to the "Animations Holder" field in the Procedural Animator component.

The "Animations" game object is an empty game object that acts as a parent for all animations.
Creating An Animation
To create an animation, right-click on the Animations game object, then navigate to Akila > FPS Framework > Animation System > Procedural Animation. This will create a new procedural animation as a child of the Animations game object.

Procedural Animations Fields
Name
The name of the animation by which the animator can locate it.
length
The duration of the animation.
Weight
The extent to which this animation influences the overall values of the animator.
Under these main fields, you’ll find sections like Options and Trigger Type. For details on how triggering works, check out the Triggering The Animation section.
Options are basically a set of behaviors you can toggle on or off. As shown in the screenshot below, you can enable any combination of them depending on what you need.

By default, the animation’s options are set to Nothing, which means none of these behaviors will run unless you turn them on yourself.
Here’s a breakdown of each option and what it does:
Loop
Starts the animation from the beginning when it reaches to 99% of its length.
Auto Stop
Stops the animation once it reaches 99% of its length.
Per Modifer Connection
Applies the "Connections" to modifiers as well as to the animation’s progress.
Play On Awake
Plays the animation from the beginning as soon as the animation GameObject is enabled.
Unidirectinal Play
Only allows the animation to be played if it starts below 10 percent of its length.
Reset On Play
Always starts the animation from the very beginning, resetting the progress to 0.
Isolate
Makes the animation apply its values directly to the transform it’s attached to instead of sending the output to the animator to apply.
Triggering The Animation
The animation component itself does nothing unless triggered. To trigger the animation, you can call this function:
using Akila.FPSFramework
public class NewBehaviourScript : MonoBehaviour
{
// Reference to the animation, assigned from the inspector
public ProceduralAnimation proceduralAnimation;
private void Start()
{
//Play the animation from the beginning.
//If the given value is 0.5, the animation will play from the middle.
//If you don't pass a value, the animation will not be reset to a specific time.
proceduralAnimation.Play(0);
}
}Another way to play an animation is by using the built-in input method. The ProceduralAnimation component has a field called Trigger Type, which determines how the input is handled. The Trigger Type has four options:
None: No input is required to trigger the animation.
Tap: The animation plays when the user taps the assigned key/button once.
Hold: The animation plays as long as the user holds the assigned key/button.
Double Tap: The animation plays when the user taps the assigned key/button twice in quick succession.
Below the Trigger Type field, there's an input action field where you can assign any key or button to trigger the animation, allowing for flexible input handling.

Modifiers
Animations can be modified using various modifiers. To apply any of the default modifiers, you simply need to add the corresponding component to your animation. The available modifiers are:
KickAnimationModifier: Adds a kick effect to the animation.
SpringAnimationModifier: Adds a spring-like behavior to the animation, making it more dynamic.
WaveAnimationModifier: Introduces a wave-like motion to the animation, useful for more fluid or organic movements.
MoveAnimationModifier: Allows for additional movement, such as shifting positions or adding extra translation to the animation.
To apply any of these modifiers, just add the appropriate component (e.g., the KickAnimationModifier component) to your animation. Each modifier will modify the animation's behavior accordingly.

Creating new modifiers
To create a new modifier, follow these steps:
Create a New Script Create a new C# script for your modifier.
Add the Namespace At the top of the script, add the following namespace to access the animation framework:
using Akila.FPSFramework.Animation;This will allow you to create custom modifiers that can interact with the procedural animation system.
Next, change the class inheritance to ProceduralAnimationModifier to allow the animation system to recognize and use the modifier. Here's how you would modify the script:
using Akila.FPSFramework.Animation;
public class MyCustomModifier : ProceduralAnimationModifier
{
// Custom modifier logic here
}By inheriting from ProceduralAnimationModifier, your custom modifier will now be identifiable by the animation system, and its values can be used to modify the behavior of the animation.
With this setup, the modifer is working as intended but it's not doing anything to the animation, to make it change the animation values, you can change some fields' values.
Procedural Animation Modifier Fields
targetAnimation
The target animation that this modifier is affecting.
targetPosition
Final position result for this modifier.
targetRotation
Final rotation result for this modifier.
Last updated
Was this helpful?