Animation System
A procedural system that makes creating smooth and fluid animations easier than ever.
Last updated
Was this helpful?
A procedural system that makes creating smooth and fluid animations easier than ever.
Last updated
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:
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.
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.
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.
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.
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.
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:
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.
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.
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:
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:
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.
targetAnimation
The target animation that this modifier is affecting.
targetPosition
Final position result for this modifier.
targetRotation
Final rotation result for this modifier.