๐Ÿงพ
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
  • Overview
  • Code example
  1. Workflow

Linking

In this section we will learn how to link layers.

PreviousProfiles and LayersNextIntegration

Last updated 9 months ago

Overview

The linking process is used to smoothly blend in our desired Animator Profile in runtime.

Let's take at the linking functionality in the source code:

public void UnlinkAnimatorProfile() { ... }
public void LinkAnimatorProfile(GameObject itemEntity) { ... }
public void LinkAnimatorProfile(FPSAnimatorProfile newProfile) { ... }

The system has a way to link a Game Object, if it contains the Animator Profile. This is only possible if your Game Object has an FPSEntityComponent:

Then, in your controller code, you can just pass the weapon Game Object to the LinkAnimatorProfile method, and it will work as expected.

The UnlinkAnimatorProfile is used to blend out the currently active profile, which might be useful when you do not want to use the system at all.

Code example

Let's see how we can apply the linking in practice. Here's a code snippet from the demo:

Weapon.cs
public override void OnEquip(GameObject parent)
{
    ...
    _fpsAnimator.LinkAnimatorProfile(gameObject);
    ...
}

In the demo project, weapons control the equipment logic, and because our weapon has an FPS Animator Entity component, we can just pass the gameObject as a parameter.

It is also possible to link individual layers:

Weapon.cs
public override void OnUnEquip()
{
    _fpsAnimator.LinkAnimatorLayer(unEquipMotion);
}

In this example, we play a procedural unequip animation by dynamically linking an unEquipMotion.


In the next section, we will learn how to integrate animation framework components with a third-party controller.

๐Ÿ”—