๐Ÿงพ
FPS Animation Framework
  • ๐Ÿ‘‹Welcome!
  • Workflow
    • ๐ŸฆพCharacter Rig
    • ๐Ÿ”ŒComponents
    • ๐Ÿ”ธProfiles and Layers
    • ๐Ÿ”—Linking
    • โž•Integration
    • โ–ถ๏ธPlaying Animations
    • ๐Ÿ’ปExtending the System
  • Demo Project
    • โœจResources
    • ๐ŸŽฎController
    • ๐Ÿ”ซWeapons and Items
    • โž•Attachment System
  • Fundamentals
    • ๐ŸฆพRig
    • โš™๏ธFramework Architecture
    • ๐Ÿ“‘Animator Profiles
    • ๐Ÿ“œAnimator Layer
    • ๐ŸŽฎInput System
    • ๐Ÿ”ถAnimator Layers
      • Weapon Layer General
      • Additive Layer
      • Ads Layer
      • Attach Hand Layer
      • Collision Layer
      • IK Layer
      • IK Motion Layer
      • Look Layer
      • Pose Offset Layer
      • Pose Sampler Layer
      • Sway Layer
      • View Layer
      • Blending Layer
      • Turn Layer
    • ๐Ÿ“šNew Animation Library
    • โš’๏ธTools
  • Recoil System
    • ๐Ÿ”ซRecoil Animation
    • ใ€ฝ๏ธRecoil Pattern
    • ๐Ÿ“นCamera Shake
  • Troubleshooting
    • โš ๏ธInitialization Warnings
    • โš ๏ธCan't Look Around
    • โš ๏ธWeapon Positioning
    • โš ๏ธWeapon is not moving
  • โš ๏ธAiming doesn't work
  • โš ๏ธTwisted feet when looking left/right
  • ๐ŸŒŒMisc
    • ๐Ÿ“œChangelog
      • 4.7.0 Update
Powered by GitBook
On this page
  • KAnimationMath
  • KCurves
  • KMath
  • KSpringMath
  • KTransform
  • KPose
  • KTwoBoneIK
  1. Fundamentals

New Animation Library

In this section you will get an overview of the new animation core.

PreviousTurn LayerNextTools

Last updated 5 months ago

The Scriptable Animation System is a complex technology, which brings not just a single plugin, but a new way to organize, manage and extend the functionality of animation features in your game.

Let's start with a new KAnimationCore plugin, which adds a solid low-level library of animation functions and types.

KAnimationMath

This class includes static functions to manipulate transforms in real time. It essentially replaces the CoreToolkitLib from the previous version. The only difference is that KAnimationMath is responsible for animation functions only.

KCurves

Includes everything related to the curves in the framework. This includes new curve types and easing functions.

KMath

A new library designed for general math operations.

KSpringMath

This class implements runtime spring computation. You can use it if you wish to add a spring interpolation to your feature.

KTransform

This is a struct that is identical to the Unity built-in Transform type. The only difference is that it is a struct, which means we can use it safely in Unity Jobs!

This struct has all the methods to manipulate the transform:

public static KTransform Lerp(KTransform a, KTransform b, float alpha)

// Frame-rate independent interpolation.
public static KTransform ExpDecay(KTransform a, KTransform b, float speed, float deltaTime)

public bool Equals(KTransform other, bool useScale)

// Returns a point relative to this transform.
public Vector3 InverseTransformPoint(Vector3 worldPosition, bool useScale)

// Returns a vector relative to this transform.
public Vector3 InverseTransformVector(Vector3 worldDirection, bool useScale)

// Converts a local position from this transform to world.
public Vector3 TransformPoint(Vector3 localPosition, bool useScale)

// Converts a local vector from this transform to world.
public Vector3 TransformVector(Vector3 localDirection, bool useScale)

// Returns a transform relative to this transform.
public KTransform GetRelativeTransform(KTransform worldTransform, bool useScale)

// Converts a local transform to world.
public KTransform GetWorldTransform(KTransform localTransform, bool useScale)

KPose

KPose defines how the selected element will be modified in real time. It is often used by Animator Layers, but you can also find it useful for other applications:

Element defines the bone/element that will be modified, and Pose is a KTransform that represents the value.

Space defines where our applications will be done. So far the system supports:

  • Bone space: the space of the element's current frame.

  • Parent Bone space: the space of the parent bone.

  • Component space: the space of the character root bone.

  • World space: the global space, a standard world space.

Modify Mode defines how the Pose will be applied:

  • Add: the Pose will be added to the element.

  • Replace: the Pose will replace the element's transform.

KTwoBoneIK

This class implements a two-bone IK algorithm, which is Unity Jobs-friendly! The Solve function uses KTransform by default and also provides a KTwoBoneIkJob class to solve inverse kinematics for multiple limbs in ParallelFor.

By default, this class is used in the IkLayerState class to apply inverse kinematics.

As you can see, the new KAnimationUtilty is a way more streamlined, and most importantly independent from the main code-based, which makes it possible to use outside of the framework.

In the next section, we will learn more about the KRig assets.

๐Ÿ“š
KPose Example.