⚙️
FPS Framework
Asset StoreFab
  • Get Started
    • Welcome!
    • Setup
  • Tutorials
    • Character
      • First-Person Controller
      • Inventory
      • Firearm
        • Basics
        • Advanced
        • Other
          • Spray pattern
          • Attachment System
          • Projectile System
      • Explosive
    • Systems
      • Audio System
      • Animation System
      • Interactions
        • Pickable
      • Save System
      • Settings System
    • Tools
      • Extension Methods
    • UI
      • FPS Counter
      • Get Name
      • Image Size Fitter
  • Other
    • Full Change Log
      • 2025 Change Log
      • 2024 Change Log
      • 2023 Change Log
      • 2022 Change Log
Powered by GitBook
On this page
  • Creating An Animator
  • Creating An Animation
  • Triggering The Animation
  • Modifiers
  • Creating new modifiers

Was this helpful?

  1. Tutorials
  2. Systems

Animation System

A procedural system that makes creating smooth and fluid animations easier than ever.

PreviousAudio SystemNextInteractions

Last updated 1 month ago

Was this helpful?

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:

  1. ProceduralAnimator This component manages all procedural animations, calculates their combined effects, and applies the final results to the target object or transform.

  2. 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

Name
Description

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
Description

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.

Loop

If enabled, the animation will loop from the beginning once it finishes.

Auto Stop

If enabled, IsPlaying will be set to false once the animation finishes playing.

Per Modifier Connection

If enabled, each modifier will be affected by the animation's connections.

Play On Awake

If enabled, the animation will play automatically when the game starts.

Isolate

If enabled, the animation will function independently without the need for an animator and will affect the game object it is attached to.

Connections

The connections associated with this animation, which can be used to make animations work together.

Events

The default events of this animation, which are On Trigger (Enter, Stay, and Exit).

Custom Events

The custom events at specific locations within this animation. A location of 0.5 corresponds to the middle of the animation.

Triggering The Animation

After addin the Procedural Animation component, 2 other component have been added by automaticly which are Procedural Animation Trigger and Procedural Animation Modifiers Manager.

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:

  1. None: No input is required to trigger the animation.

  2. Tap: The animation plays when the user taps the assigned key/button once.

  3. Hold: The animation plays as long as the user holds the assigned key/button.

  4. 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:

  1. Create a New Script Create a new C# script for your modifier.

  2. 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.

You should review the base class ProceduralAnimationModifier and all the default modifier content before writing a new modifier.

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

Name
Description

targetAnimation

The target animation that this modifier is affecting.

targetPosition

Final position result for this modifier.

targetRotation

Final rotation result for this modifier.