# Table of Contents - [Welcome! | FPS Animation Framework](#welcome-fps-animation-framework) - [Profiles and Layers | FPS Animation Framework](#profiles-and-layers-fps-animation-framework) - [Playing Animations | FPS Animation Framework](#playing-animations-fps-animation-framework) - [Integration | FPS Animation Framework](#integration-fps-animation-framework) - [Character Rig | FPS Animation Framework](#character-rig-fps-animation-framework) - [Components | FPS Animation Framework](#components-fps-animation-framework) - [Linking | FPS Animation Framework](#linking-fps-animation-framework) - [Extending the System | FPS Animation Framework](#extending-the-system-fps-animation-framework) - [Framework Architecture | FPS Animation Framework](#framework-architecture-fps-animation-framework) - [Weapons and Items | FPS Animation Framework](#weapons-and-items-fps-animation-framework) - [Animator Layers | FPS Animation Framework](#animator-layers-fps-animation-framework) - [Resources | FPS Animation Framework](#resources-fps-animation-framework) - [Attachment System | FPS Animation Framework](#attachment-system-fps-animation-framework) - [Controller | FPS Animation Framework](#controller-fps-animation-framework) - [Animator Profiles | FPS Animation Framework](#animator-profiles-fps-animation-framework) - [Welcome! | PRAS Documentation](#welcome-pras-documentation) - [Input System | FPS Animation Framework](#input-system-fps-animation-framework) - [Rig | FPS Animation Framework](#rig-fps-animation-framework) - [Recoil Settings | PRAS Documentation](#recoil-settings-pras-documentation) - [Recoil Animation | PRAS Documentation](#recoil-animation-pras-documentation) - [Getting Set Up | PRAS Documentation](#getting-set-up-pras-documentation) - [How to implement attachments | PRAS Documentation](#how-to-implement-attachments-pras-documentation) - [Animator Layer | FPS Animation Framework](#animator-layer-fps-animation-framework) - [Aiming doesn't work | FPS Animation Framework](#aiming-doesn-t-work-fps-animation-framework) - [Twisted feet when looking left/right | FPS Animation Framework](#twisted-feet-when-looking-left-right-fps-animation-framework) - [New Animation Library | FPS Animation Framework](#new-animation-library-fps-animation-framework) - [Weapon Layer General | FPS Animation Framework](#weapon-layer-general-fps-animation-framework) - [Additive Layer | FPS Animation Framework](#additive-layer-fps-animation-framework) - [Pose Sampler Layer | FPS Animation Framework](#pose-sampler-layer-fps-animation-framework) - [Weapon Positioning | FPS Animation Framework](#weapon-positioning-fps-animation-framework) - [Can't Look Around | FPS Animation Framework](#can-t-look-around-fps-animation-framework) - [Collision Layer | FPS Animation Framework](#collision-layer-fps-animation-framework) - [Initialization Warnings | FPS Animation Framework](#initialization-warnings-fps-animation-framework) - [Attach Hand Layer | FPS Animation Framework](#attach-hand-layer-fps-animation-framework) - [Ads Layer | FPS Animation Framework](#ads-layer-fps-animation-framework) - [Recoil Animation | FPS Animation Framework](#recoil-animation-fps-animation-framework) - [Weapon is not moving | FPS Animation Framework](#weapon-is-not-moving-fps-animation-framework) - [Pose Offset Layer | FPS Animation Framework](#pose-offset-layer-fps-animation-framework) - [Recoil Pattern | FPS Animation Framework](#recoil-pattern-fps-animation-framework) - [Changelog | FPS Animation Framework](#changelog-fps-animation-framework) - [4.7.0 Update | FPS Animation Framework](#4-7-0-update-fps-animation-framework) - [IK Motion Layer | FPS Animation Framework](#ik-motion-layer-fps-animation-framework) - [Look Layer | FPS Animation Framework](#look-layer-fps-animation-framework) - [IK Layer | FPS Animation Framework](#ik-layer-fps-animation-framework) - [Tools | FPS Animation Framework](#tools-fps-animation-framework) - [View Layer | FPS Animation Framework](#view-layer-fps-animation-framework) - [Sway Layer | FPS Animation Framework](#sway-layer-fps-animation-framework) - [Turn Layer | FPS Animation Framework](#turn-layer-fps-animation-framework) - [Blending Layer | FPS Animation Framework](#blending-layer-fps-animation-framework) - [Camera Shake | FPS Animation Framework](#camera-shake-fps-animation-framework) - [Rig | FPS Animation Framework](#rig-fps-animation-framework) - [Resources | FPS Animation Framework](#resources-fps-animation-framework) - [Initialization Warnings | FPS Animation Framework](#initialization-warnings-fps-animation-framework) - [Changelog | FPS Animation Framework](#changelog-fps-animation-framework) - [Recoil Animation | PRAS Documentation](#recoil-animation-pras-documentation) --- # Welcome! | FPS Animation Framework ![Page cover](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FBoDXPIa2WwkVfCfovM1h%252FYoutube-1_t.png%3Falt%3Dmedia%26token%3D5741ab33-fb60-4742-934d-f64389fb9d5c&width=1248&dpr=3&quality=100&sign=1c7ed93d&sv=2) [**Asset Store**arrow-up-right](https://u3d.as/2XD3) • [**YouTube**arrow-up-right](https://www.youtube.com/@kinemationstudio) • [**Discord**arrow-up-right](https://discord.gg/kinemation-1027338787958816860) **FPS Animation Framework** introduces a new way to animate First Person Shooter games in Unity. Explore the cutting-edge animation features, modular design, and various tools to take your project to the next level. In this document, we will cover the main features of the system, as well as differences with the previous version. Latest update. Video tutorials. [NextCharacter Rigchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig) Last updated 1 year ago --- # Profiles and Layers | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/profiles-and-layers#overview) Overview ------------------------------------------------------------------------------------------------------------------------ **Animator Profile** contains all the procedural features related to a weapon, item, or gameplay situation. To create a new profile, right-click on your **Rig Asset** and select **FPS PROFILE Wizard**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FFRAJR0cTuJczAjjJ5M9l%252Fimage.png%3Falt%3Dmedia%26token%3Da3f297a6-50a6-40aa-9b8e-329f1e132c9e&width=768&dpr=3&quality=100&sign=e982af62&sv=2) Animator Profile. chevron-rightHow to create a profile manually[hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/profiles-and-layers#how-to-create-a-profile-manually) Right-click in any folder and go to **Create/KINEMATION/FPS Animator General/Animator Profile** * **Rig Asset** - assign previously created Rig Asset. It will provide bone data to all Animator Layers. * **Blend In/Out Time** \- defines the blending time for this Profile in seconds. * **Ease Mode** - the easing function for the blending. To add a new **Animator Layer**, click on the _Add Animator Layer_ button and select the desired type from the list: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F78caEzufRBUCW4tRfPIk%252Fimage.png%3Falt%3Dmedia%26token%3Dd0c7ad13-e6c5-43d7-84c4-144fbfa25320&width=768&dpr=3&quality=100&sign=bb7f23ff&sv=2) All layers. You can copy/paste layer settings by right-clicking on the layer: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252Fu5YlagonWQa387YLeoDW%252Fimage.png%3Falt%3Dmedia%26token%3Db4be4301-5d90-4034-bcec-2d6978960332&width=768&dpr=3&quality=100&sign=4d064373&sv=2) Context menu. circle-check **Tip:** now you can start adding Animator Layers to the profile. There are no mandatory layers for the system, which makes it incredibly flexible not just for items or weapons, but for gameplay situations as well. Usually, for any item or weapon-related profile the order of layers is similar to this: 1. Pose Sampler Layer 2. Other layers 3. Ik Layer circle-check **Tip**: Pose Sampler will position the weapon bone and IK targets, which later will be modified by other procedural layers, and finalized by applying the inverse kinematics for arms and legs. You can find out more about each layer and its settings in [Animator Profiles](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles) section. * * * In the next section, we will learn how to apply **Animator Profiles** in runtime using a Linking mechanism. [PreviousComponentschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components) [NextLinkingchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/linking) Last updated 1 year ago --- # Playing Animations | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/playing-animations#animation-asset) Animation Asset ------------------------------------------------------------------------------------------------------------------------------------- The **FPS Animation Framework** uses Animation Assets to play custom animations on your character from code. To create a new asset, right-click and go to **Create/KINEMATION/FPS Animator General/Animation Asset**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FXFzs9kLR4Ajp1lJlRoTj%252Fimage.png%3Falt%3Dmedia%26token%3Db94d26c3-8c6d-4084-b624-c4234b337430&width=768&dpr=3&quality=100&sign=304d5274&sv=2) First, you must specify the **Rig Asset** - it will be used to pick the curve names via a popup widget. Then, make sure to assign the actual Animation Clip. * **Mask** property is optional, but you can use it if you need to affect a specific part of the body. * **Override Mask** and **Is Additive** are used for shared animations, like emotes, grenade throws, etc. The **Override Mask** will make the left arm use absolute animation, while the right arm will only use additive motion. * **Blend Time** controls the transition for your animation. The **Rate Scale** is a playback speed multiplier. * The **Curves** list defines custom curves, which will be used in this animation. This is an extremely useful feature when you want custom animations to control animation features. circle-check **Example:** let's say we want to disable left-hand IK when reloading. Add the MaskAttachHand curve to the animation, set its value to 1. Now we can use this curve as a mask parameter in the left-hand IK layer, which will blend it out when the animation is playing. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/playing-animations#code) Code --------------------------------------------------------------------------------------------------------------- To play an Animation Asset from code, you need to call the PlayAnimation method on the **IPlayablesController**: Copy // Where yourAnimation is an Animation Asset. // Second parameter is the start time. _playablesController.PlayAnimation(yourAnimation, 0f); * * * In the next section, we will learn how to create custom animation features. [PreviousIntegrationchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration) [NextExtending the Systemchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/extending-the-system) Last updated 1 year ago --- # Integration | FPS Animation Framework **FPS Animation Framework** offers a streamlined integration process. Let's start with the custom controller integration. We will use the FPSController script from the demo project as an example. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#initialization) Initialization ---------------------------------------------------------------------------------------------------------------------------- First, you need to add references to the framework core components: Copy private FPSAnimator _fpsAnimator; // Central management component. private UserInputController _userInput; // Dynamic input system. private FPSCameraController _fpsCamera; // Camera system. private IPlayablesController _playablesController; // Dynamic animation system. private RecoilAnimation _recoilAnimation; // Recoil effect component. Then, make sure to initialize all the components: Copy _fpsAnimator = GetComponent(); _fpsAnimator.Initialize(); _userInput = GetComponent(); _fpsCamera = GetComponentInChildren(); _playablesController = GetComponent(); _recoilAnimation = GetComponent(); triangle-exclamation **Note**: make sure to initialize the **FPS Animator** component! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#updating-input) Updating Input ---------------------------------------------------------------------------------------------------------------------------- When updating user input, we typically need to refresh aiming and movement inputs: Copy private void UpdateInput() { ... _userInput.SetValue(FPSANames.MouseDeltaInput, new Vector4(deltaMouseX, deltaMouseY)); _userInput.SetValue(FPSANames.MouseInput, new Vector4(mouseX, mouseY)); _userInput.SetValue(FPSANames.MoveInput, new Vector4(moveX, moveY)); ... } [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#weapon-change) Weapon change -------------------------------------------------------------------------------------------------------------------------- When switching weapons, we need to link a new Animator Profile: Copy private void EquipWeapon() { ... _fpsAnimator.LinkAnimatorProfile(gun.gameObject); ... } [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#aiming) Aiming ------------------------------------------------------------------------------------------------------------ Copy private void OnAimPressed() { _userInput.SetValue(FPSANames.IsAiming, true); _recoilAnimation.isAiming = true; _fpsCamera.UpdateTargetFOV(aimFov); { private void OnAimReleased() { _userInput.SetValue(FPSANames.IsAiming, false); _recoilAnimation.isAiming = false; _fpsCamera.UpdateTargetFOV(defaultFov); } Additionally, we access the **FPSCameraController**, and adjust the target FOV. We also adjust the recoilAnimation aiming status, which is important as it will adjust the animation accordingly. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#playing-animations) Playing animations ------------------------------------------------------------------------------------------------------------------------------------ To play an animation from code, you need to call the: Copy // Where yourAnimation is an Animation Asset. _playablesController.PlayAnimation(yourAnimation, 0f); You can also specify the start time of the animation as a second parameter, which might be useful for mechanics like staged reloads. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#recoil) Recoil ------------------------------------------------------------------------------------------------------------ The recoil is implemented via **Recoil Animation** component and **Camera Shakes**. First, we need to initialize the Recoil Animation component when a gun is equipped: Copy _recoilAnimation.Init(gun.recoilData, gun.fireRate, gun.isAuto ? FireMode.Auto : FireMode.Semi); You only need to add the **Recoil Data** to your custom weapon class. The Recoil Data is a Scriptable Object, that contains the information about the procedural recoil animation. Next, we need to apply the recoil effect in runtime: Copy // Called every shot. private void Fire() { // Make sure to add an FPSCameraShake public field to your weapon class. _fpsCamera.PlayCameraShake(GetGun().cameraShake); if (_recoilAnimation != null) _recoilAnimation.Play(); } // Called when firing key is released. private void StopFiring() { if (_recoilAnimation != null) _recoilAnimation.Stop(); } [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration#making-adjustments) Making adjustments ------------------------------------------------------------------------------------------------------------------------------------ Sometimes it is necessary to adjust our system's behavior in runtime, depending on gameplay situations. In the **FPS Animation Framework** it is implemented primarily via the Input System: Copy private void OnSprintStarted() { _userInput.SetValue(FPSANames.StabilizationWeight, 0f); _userInput.SetValue(FPSANames.PlayablesWeight, 0f); } private void OnSprintEnded() { _userInput.SetValue(FPSANames.StabilizationWeight, 1f); _userInput.SetValue(FPSANames.PlayablesWeight, 1f); } In the example above, we toggle the Playables systems and stabilization based on the sprinting status. You can adjust custom properties in a similar way, depending on the requirements of your project. * * * At this point, the integration is complete. In the next section, we will learn more about dynamic animations. [PreviousLinkingchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/linking) [NextPlaying Animationschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/playing-animations) Last updated 1 year ago --- # Character Rig | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig#wizard-setup) Wizard Setup -------------------------------------------------------------------------------------------------------------------------- The **FPS Animation Framework** automates the setup process. Add your character to the scene, right-click on it, and select **FPS ANIMATOR Wizard**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FDgv53epv1sbghskaMn3S%252Fimage.png%3Falt%3Dmedia%26token%3Dda52db1b-b771-4c23-8e30-05b77d90871f&width=768&dpr=3&quality=100&sign=6e4b52e7&sv=2) Wizard Tool Window. circle-check **Note:** this tool will automatically find and assign all the important bones. It is recommended to double-check the references, as sometimes real bones can be confused with other game objects. After that, we need to assign an **Animator Controller** - you can either use yours or the one from the demo project. Next, we need to assign **Input Config** - a crucial data asset the entire system depends on. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig#about-input-config) About Input Config -------------------------------------------------------------------------------------------------------------------------------------- You can select one from the FPS Animation Framework package: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FWDGd4P0kM01FZqPYmWtM%252Fimage.png%3Falt%3Dmedia%26token%3D57255abf-79ca-4c64-ba28-9ecd79ff320a&width=768&dpr=3&quality=100&sign=b42aeb58&sv=2) Input Config asset. **Input Config** contains runtime properties, which will be used in our system. It is essential for communication between the FPS Animation Framework entities and your custom code. It is very similar to the [Animator Controller parametersarrow-up-right](https://docs.unity3d.com/Manual/AnimationParameters.html) but with way more customization features: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FLM1ZYRnO4WNzlGinr78s%252Fimage.png%3Falt%3Dmedia%26token%3D474dc36c-20b0-441e-b5de-ed679fb934d2&width=768&dpr=3&quality=100&sign=a3c491a6&sv=2) Input Config. circle-check **Tip**: instead of hardcoding the user inputs in a class or a struct, this dynamic approach gives you more flexibility. To create a **UserInputConfig** manually**,** right-click in any folder and go to **Create/KINEMATION/Input Config**: triangle-exclamation **Note:** even though you can manually create an Input Config, it is recommended to use an example asset from **KINEMATION/FPS Animation Framework/Assets** folder. You can find out more here: [Input System](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system) Once the **Input Config** is created or/and assigned, let's find out what the **Rig Asset** is. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig#about-rig-asset) About Rig Asset -------------------------------------------------------------------------------------------------------------------------------- circle-check **Tip:** One of the groundbreaking features implemented in the FPS Animation Framework is the new way of storing information about the character skeleton - **Rig Assets**. They contain all the crucial information about the character, and they are used to dynamically select _Rig Elements_, _Rig Chains,_ and _Curves_ in the Editor. You do not have to manually create a **Rig Asset** - it will be automatically created when you press the _Setup Character_ button: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FoCadtI9CuPNftrl2u6Cu%252Fimage.png%3Falt%3Dmedia%26token%3Ddd2fcab8-4fb8-4a7a-900f-be36f27112df&width=768&dpr=3&quality=100&sign=b552b1b1&sv=2) Press this button. chevron-rightHow to create a Rig Asset manually[hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig#how-to-create-a-rig-asset-manually) Right-click in any folder and go to **Create/KINEMATION/Rig.** Once you have created and/or assigned a **Rig Asset**, make sure to press the _Setup Character_ button. This will create a subfolder in the current directory with the rig asset in it. Now let's see what this Scriptable Object contains: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FwRRrDpDNycKAC4afBm9u%252Fimage.png%3Falt%3Dmedia%26token%3D9cc914f7-b18c-486b-87af-c58e1ed4ad02&width=768&dpr=3&quality=100&sign=65dbc3b6&sv=2) Rig Asset. The **Rig Asset** contains all the information about your character skeleton, including: * _**Hierarchy**_ - actual hierarchy of your character. * _**Element Chains**_ - an alternative to Avatar Masks. * _**Curves**_ \- Playable curves for dynamic animations (e.g. reloading, grenade throw, etc.) * * * The character skeleton is now ready, in the next section we will learn more about the framework components. [PreviousWelcome!chevron-left](https://kinemation.gitbook.io/scriptable-animation-system) [NextComponentschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components) Last updated 1 year ago --- # Components | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#overview) Overview --------------------------------------------------------------------------------------------------------------- After the previous step, these components had been added to our character: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FKgsqSOBkSuISuo9HpHr2%252Fimage.png%3Falt%3Dmedia%26token%3De53d8894-1c58-4e99-a1fa-be9d583892ae&width=768&dpr=3&quality=100&sign=b56fe6e2&sv=2) Components. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#fps-animator) FPS Animator ----------------------------------------------------------------------------------------------------------------------- It is a central hub component, which controls the flow of all entities in the framework, by initializing, updating, and disposing of other components. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#fps-bone-controller) FPS Bone Controller ------------------------------------------------------------------------------------------------------------------------------------- This component applies procedural animation features. It does not have any special properties, hence there is no special setup for this component. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#user-input-controller) User Input Controller ----------------------------------------------------------------------------------------------------------------------------------------- The **FPS Animation Framework** introduces a standalone input property system. The idea is that you can define custom properties in the **Input Config** asset and use them in runtime: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FLM1ZYRnO4WNzlGinr78s%252Fimage.png%3Falt%3Dmedia%26token%3D474dc36c-20b0-441e-b5de-ed679fb934d2&width=768&dpr=3&quality=100&sign=a3c491a6&sv=2) This asset contains your custom properties. This system is used to establish communication between the framework entities and your project codebase. circle-check **Example:** let's say you want to disable aiming when jumping. You can create a new float parameter, set it to 1 or 0 in code based on the jumping condition, and then specify that parameter as a control value in the Ads Layer. **User Input Controller** allows you to work with the property system, by getting or setting the values: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F4x0krusF2VbF5yxBDgcg%252Fimage.png%3Falt%3Dmedia%26token%3Dae2f93ff-a3ac-48a4-9020-5eafbdc874c7&width=768&dpr=3&quality=100&sign=7cc9567f&sv=2) Specify the input asset. circle-check **Tip:** the User Input Component inspector has a really neat feature - it displays all the properties in play mode, and you can even modify them. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#playables-controller) Playables Controller --------------------------------------------------------------------------------------------------------------------------------------- This component controls how Animation Clips are played in runtime. It uses [Unity Playables APIarrow-up-right](https://docs.unity3d.com/Manual/Playables.html) to add custom animation layers, that allow you to play animations right from code. Create a new Avatar mask, select the upper body bones, and assign it to this component: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252Fvfvoq2Zl35huXV6jwfFJ%252Fimage.png%3Falt%3Dmedia%26token%3Dd769b1f8-f386-4ae5-b472-00605589fa09&width=768&dpr=3&quality=100&sign=692bd5d&sv=2) Playables Controller inspector. Your upper body mask needs to be adjusted to play custom animations. To do this, go to **Window/FPS ANIMATOR/Tools/Avatar Mask Modifier.** Now we need to add the WeaponBone object to the avatar mask. Specify the _Root_ and the _Upper Body Mask_: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FZowmgxbyxBPMCSoRdWQP%252Fimage.png%3Falt%3Dmedia%26token%3Dccf93be4-8dc0-4331-940a-9bca656ac2d9&width=768&dpr=3&quality=100&sign=9aca7d57&sv=2) Press the Add Bone button. circle-check **Tip:** the WeaponBone will be used later in the animation workflow, essentially it contains the weapon movement. The **Playables Weight Property** is used to control the influence of the Playbles Controller. You can specify here any float value from the input system, but it is recommended to leave the PlayablesWeight as a default value. You can also use this component to preview animations in the editor. Just select your animations and hit the preview button! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components#execution-order) Execution order ----------------------------------------------------------------------------------------------------------------------------- Lastly, we need to adjust the _Script Execution Order_ in the _Project Settings_. Go to the **Edit/Project Settings/Script Execution Order** and make sure to put the **FPS Animator** after your controller class: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FuKODYHO6QBqe2Zo9pfmI%252Fimage.png%3Falt%3Dmedia%26token%3Db42ace0d-16d8-4d1b-8066-958d26eb96a4&width=768&dpr=3&quality=100&sign=17b6dc98&sv=2) FPSController can be your controller class, where you use the FPS Animator component. circle-check **Tip:** this step is required for the proper input update process, so the **FPS Animator** can use the latest user data to avoid lagging. It is also important to initialize the **FPS Animator** component in the controller. This can be done by calling the _Initialize()_ method: ExampleController.cs Copy private void Start() { _fpsAnimator = GetComponent(); _fpsAnimator.Initialize(); } * * * At this point, the character setup is complete. In the next section, we will learn about the procedural animation assets. [PreviousCharacter Rigchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig) [NextProfiles and Layerschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/profiles-and-layers) Last updated 1 year ago --- # Linking | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/linking#overview) 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: Copy 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**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F6Z2p5ZBgXpbsLJ9R9bLF%252Fimage.png%3Falt%3Dmedia%26token%3Dde54dc55-4763-4de7-9011-d47a9f18cb3a&width=768&dpr=3&quality=100&sign=902709ae&sv=2) 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. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/linking#code-example) Code example -------------------------------------------------------------------------------------------------------------------- Let's see how we can apply the linking in practice. Here's a code snippet from the demo: Weapon.cs Copy 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 Copy 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. [PreviousProfiles and Layerschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/profiles-and-layers) [NextIntegrationchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/workflow/integration) Last updated 1 year ago --- # Extending the System | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/extending-the-system#overview) Overview ------------------------------------------------------------------------------------------------------------------------- A procedural animation feature consists of 2 entities: * **FPSAnimatorLayerSettings:** a Scriptable Object that contains all the data. * **IAnimationLayerJob:** a struct that executes custom animation logic. circle-check **Tip**: the framework uses the Animation Job System, which ensures solid performance even with a large number of characters. If you open up the source code of the framework, you will notice that every layer has its own folder with 2 .cs files: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FXJ09sOiLC5TQCFQEzGoV%252Fimage.png%3Falt%3Dmedia%26token%3Da298a7cb-98e3-46c2-8da8-673ccbde1cf7&width=768&dpr=3&quality=100&sign=d5fdae74&sv=2) AdditiveLayer example. **FPSAnimatorLayerSettings** class is responsible not just for containing the data, but for instantiating the **IAnimationLayerJob** as well: AdditiveLayerSettings.cs Copy public class AdditiveLayerSettings : WeaponLayerSettings { ... public override IAnimationLayerJob CreateAnimationJob() { return new AdditiveLayerJob(); } } **CreateAnimationJob()** method must return a new instance of the desired **IAnimationLayerJob**\-type. When you link a new **Animator Profile**, the system iterates over all animation features (_Layer Settings_) and then invokes the _CreateAnimationJob()_ method to create the _Layer State_. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/workflow/extending-the-system#example) Example ----------------------------------------------------------------------------------------------------------------------- First, create a new **FPSAnimatorLayerSettings**\-derived class for data, and **IAnimationLayerJob**\-implemented struct: YourFeatureLayerSettings.cs Copy public class YourFeatureLayerSettings : FPSAnimatorLayerSettings { //Define your settings here, including the KRigElements. public KRigElement myRigElement; public override IAnimationLayerJob CreateAnimationJob() { return new YourAnimationLayerJob(); } #if UNITY_EDITOR public override void OnRigUpdated() { base.OnRigUpdated(); // (!) Always update KRigElements here. // Called when a rig asset is updated/changed. UpdateRigElement(ref myRigElement); } #endif } YourAnimationLayerJob.cs Copy public struct YourAnimationLayerJob { private YourFeatureLayerSettings _settings; private LayerJobData _jobData; private TransformStreamHandle _yourBoneHandle; // Use this method for custom animation logic. public void ProcessAnimation(AnimationStream stream) { } // Use this for modifying root motion. public void ProcessRootMotion(AnimationStream stream) { } // This method is called when a new profile is linked. public void Initialize(LayerJobData newJobData, FPSAnimatorLayerSettings settings) { _settings = (AdditiveLayerSettings) settings; _jobData = newJobData; Transform bone = newJobData.rigComponent.GetRigTransform(settings.myRigElement); _yourBoneHandle = newJobData.animator.BindStreamTransform(bone); } public AnimationScriptPlayable CreatePlayable(PlayableGraph graph) { return AnimationScriptPlayable.Create(graph, this); } // Make sure to return a reference to the active asset. // It will be used by the FPSBoneController to compute a layer weight. public FPSAnimatorLayerSettings GetSettingAsset() { return _settings; } // Use this method to update job data when a layer is linked. public void OnLayerLinked(FPSAnimatorLayerSettings newSettings) { } // Use this method when a new weapon or item is equipped. public void UpdateEntity(FPSAnimatorEntity newEntity) { } // Use this method before the main update to gather input data. public void OnPreGameThreadUpdate() { } // Use this method to update playable data and gather game thread data. public void UpdatePlayableJobData(AnimationScriptPlayable playable, float weight) { _jobData.weight = weight; playable.SetJobData(this); } // Use this method when a finalized pose is required. public void LateUpdate() { } // Use this method to dispose data manually. public void Destroy() { } } * * * In the next chapter, we will learn how to work with the demo project. [PreviousPlaying Animationschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/playing-animations) [NextResourceschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources) Last updated 1 year ago --- # Framework Architecture | FPS Animation Framework The **FPS Animation Framework** is based on [Playables APIarrow-up-right](https://docs.unity3d.com/Manual/Playables.html) , so it can be treated as an extension of the Unity Animator Controller. > This section is in progress... [PreviousRigchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig) [NextAnimator Profileschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles) Last updated 1 year ago --- # Weapons and Items | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items#overview) Overview -------------------------------------------------------------------------------------------------------------------------- Weapons play a very important role in the demo project, as they play reloading animations, handle the firing and attachments at the same time. All weapons and items are derived from the **FPSItem** class - it contains a general interface for all entities, and its methods are used by the **FPSController** to start an action. For example: FPSController.cs Copy public void OnCycleScope() { if (!IsAiming()) return; GetActiveItem().OnCycleScope(); PlayTransitionMotion(settings.aimingMotion); } In this snippet, when we receive an _OnCycleScope_ event from the **Unity Input System**, we effectively call the general _OnCycleScope_ method on our currently equipped item. The implementation might differ, depending on the actual item the character is holding. You can leverage this behavior to implement custom functions for each character action. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items#weapon-spawn) Weapon Spawn ---------------------------------------------------------------------------------------------------------------------------------- All weapons and items are spawned when the game starts, it happens in the **FPSController**: FPSController.cs Copy foreach (var prefab in settings.weaponPrefabs) { var weapon = Instantiate(prefab, transform.position, Quaternion.identity); var weaponTransform = weapon.transform; weaponTransform.parent = _weaponBone; weaponTransform.localPosition = Vector3.zero; weaponTransform.localRotation = Quaternion.identity; _instantiatedWeapons.Add(weapon.GetComponent()); weapon.gameObject.SetActive(false); } triangle-exclamation **Note:** make sure **ALL** items and weapons are parented to the IK WeaponBone game object! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items#weapon-change) Weapon Change ------------------------------------------------------------------------------------------------------------------------------------ When changing weapons, the system first unequips anactive item: FPSController.cs Copy private void UnequipWeapon() { DisableAim(); _actionState = FPSActionState.WeaponChange; GetActiveItem().OnUnEquip(); } The actual logic is defined in the weapon class, so you have more flexibility here. We also need to disable aiming or any other kind of action. This will effcetively play an unequip animation, which is procedurally applied using the **Animator Controller**: Weapon.cs Copy public override void OnUnEquip() { _controllerAnimator.CrossFade(CurveUnequip, 0.15f); } As you can see the unequip callback is simply playing a **CurveUnequip** motion. This motion resides in the IK layer of the demo animator: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F5EMbhLPo2cczzq2FlxxY%252Fimage.png%3Falt%3Dmedia%26token%3D78454e8c-cc4d-4a4f-80e4-ee92aa47d823&width=768&dpr=3&quality=100&sign=3f47fb19&sv=2) Procedural animations. To equip the next gun, the system invokes the **EquipWeapon** method using the **equipDelay** property of the [Controller](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller#controller) settings: FPSController.cs Copy Invoke(nameof(EquipWeapon), settings.equipDelay); This action will be followed by the **OnEquip** callback of the new weapon: FPSController.cs Copy private void EquipWeapon() { if (_instantiatedWeapons.Count == 0) return; _instantiatedWeapons[_previousWeaponIndex].gameObject.SetActive(false); GetActiveItem().gameObject.SetActive(true); GetActiveItem().OnEquip(gameObject); _actionState = FPSActionState.None; } [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items#weapon-properties) Weapon Properties -------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FyXaAWV7xGRD7nW05a2Cd%252Fimage.png%3Falt%3Dmedia%26token%3Db24978a9-e508-4fa2-8687-a8487dee4fd2&width=768&dpr=3&quality=100&sign=83f7b689&sv=2) Weapon settings. * **Field Of View**: deifnes the default FOV for this weapon. This value can be scaled by scope attachments, depending on the zoom value. * **Reload Clip**: reloading animation to play. * **Camera Reload Animation**: camera reloading animation to play. * **Grenade Clip**: grenade animation to play. * **Camera Grenade Animation**: camera grenade motion to play. * **Overlay Type**: the type of the weapon. * **Recoil Data**: recoil animation asset settings. * **Recoil Pattern Settings**: general recoil system settings. * **Camera Shake**: camera shake asset, played when a shot is fired. * **Fire Rate**: weapon RPM. * **Burst Length**: the length of the burst fire. * **Barrel Attachments**: defines barrel attachments, e.g. suppressors, muzzle brakes, etc. * **Grip Attachments**: defines grip attachment. * **Scope Groups**: defines scope attachment groups. Now it is time to find out more about the attachment system. [PreviousControllerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller) [NextAttachment Systemchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system) Last updated 1 year ago --- # Animator Layers | FPS Animation Framework [Weapon Layer General](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general) [Additive Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) [Ads Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer) [Attach Hand Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer) [Collision Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer) [IK Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer) [Look Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer) [Pose Offset Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer) [Pose Sampler Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer) [Sway Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer) [View Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer) [PreviousInput Systemchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system) [NextWeapon Layer Generalchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general) Last updated 1 year ago --- # Resources | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources#unity-package) Unity Package ---------------------------------------------------------------------------------------------------------------------------- To install demo content directly into your project, simply go to Tools/KINEMATION and download the additional content for FPS Animation Framework: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FFecw6PmUag5plvJhfGIM%252Fimage.png%3Falt%3Dmedia%26token%3D3eafd33a-bd70-4730-a388-3c98b7f492ca&width=768&dpr=3&quality=100&sign=a6caed39&sv=2) How to download demo content. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources#standalone-project) Standalone project -------------------------------------------------------------------------------------------------------------------------------------- Alternatively, you get pull the latest demo version via GitHub: [![Logo](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=3&quality=100&sign=72fd77ab&sv=2)GitHub - kinemation/scriptable-animation-systemGitHubchevron-right](https://github.com/kinemation/scriptable-animation-system) Demo project repository. triangle-exclamation **Note:** the demo has dependencies on the **URP** and **Unity Input System** packages. Once you have imported the project, make sure to: * Import the framework and input system packages. * Rebuild the lighting The demo project has a very simple structure: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FKC6Iy2tJIYQV32X8vMw5%252Fimage.png%3Falt%3Dmedia%26token%3D79bd98ac-6817-4f71-ae89-b58720f6e3e0&width=768&dpr=3&quality=100&sign=7b7a29ee&sv=2) * **Demo** folder contains the actual demo settings and scripts used with the FPS Animation Framework. You can find here prefabs, weapon examples, Animator Profiles. * **KINEMATION** folder contains the actual asset, you need to add it using Package Manager. * **Level** directory contains lighting settings and the level itself. * **Tutorials** folder includes all the materials used in our video tutorials. [PreviousExtending the Systemchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/extending-the-system) [NextControllerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller) Last updated 5 months ago * [Unity Package](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources#unity-package) * [Standalone project](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources#standalone-project) --- # Attachment System | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#overview) Overview -------------------------------------------------------------------------------------------------------------------------- The demo project provides a simple attachment system, which allows you to change them in realtime. Make sure to press the **"I"** key, and the attachment editing mode will be activated. At the current state it is possible to change 3 types of attachments: * Barrel-type attachments * Grips * Scopes To cycle the attachment type make sure to press 1, 2 and 3 respectively. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#attachment-prefabs) Attachment Prefabs ---------------------------------------------------------------------------------------------------------------------------------------------- All attachments are located in the weapon prefab: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FeQZwp7dVQmi7lOBUpFR4%252Fimage.png%3Falt%3Dmedia%26token%3Db1d4cfa6-a236-470c-8dd3-a9fe888261d3&width=768&dpr=3&quality=100&sign=c033ab8d&sv=2) AK12 attachments example. **Barrel** and **Grip Attachments** properties contain a single group of attachments of the same type. You can cycle attachments by pressing 1, 2 or 3 keys. For example, if you press 1, the next grip attachment will be equipped. Scopes, however, are different. Instead of containing a single attachment group, they contain a list of attachment groups. That is because scopes usually have more sockets on the weapon, than grips and barrel attachments. Make sure to add scopes with different sockets as separate groups, otherwise you will not be able to change sights in game. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#baseattachment-scopeattachment) BaseAttachment, ScopeAttachment ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- All attachments are derived from the **BaseAttachment** class: **attachmentLayerSettings** deifne a list of animation features, which we want to link when the attachment is equipped. **BaseAttachment** is used for barrel and grip attachments, as these typically do not require that much logic. Scopes have their own attachment type: **aimFovZoom** will be multiplied by the default FOV when aiming. **sensitivityMultiplier** will scale the player input when aiming. **aimPoint** defines the active aim point socket. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#attachmentgroup) AttachmentGroup ---------------------------------------------------------------------------------------------------------------------------------------- **AttachmentGroup** represents a set of attachments, usually of the same type. This class is used to initialize, cycle and get the active attachment. This class is generic, meaning that you can use any BaseAttachment-derived type. This is a good foundation for custom attachment types. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#how-to-add-attachments) How to add attachments ------------------------------------------------------------------------------------------------------------------------------------------------------ The process is quite straightforward: 1. Add the attachment prefab to the weapon. 2. Add the BaseAttachment or ScopeAttachment component to it. 3. Then, based on the attachment type, add your attachment to the list. [PreviousWeapons and Itemschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items) [NextRigchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig) Last updated 1 year ago * [Overview](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#overview) * [Attachment Prefabs](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#attachment-prefabs) * [BaseAttachment, ScopeAttachment](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#baseattachment-scopeattachment) * [AttachmentGroup](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#attachmentgroup) * [How to add attachments](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system#how-to-add-attachments) BaseAttachment.cs Copy public class BaseAttachment : MonoBehaviour { public List attachmentLayerSettings; } ScopeAttachment.cs Copy public class ScopeAttachment : BaseAttachment { [Min(0f)] public float aimFovZoom = 1f; [Range(0f, 2f)] public float sensitivityMultiplier = 1f; public Transform aimPoint; } AttachmentGroup.cs Copy public class AttachmentGroup where T : BaseAttachment --- # Controller | FPS Animation Framework The demo project heavily relies on these 3 components: * FPSController * FPSMovement * FPSItem/Weapon [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller#fpscontroller) FPSController ----------------------------------------------------------------------------------------------------------------------------- This class is responsible for updating user input for the animation system, changing weapons and calling callbacks on the currently equipped item. The controller iteself does not implement reloading or firing logic, instead, such features are implemented in the **FPSItem** class. You can create custom entities derived directly from the **FPSItem** and override all the important functionality to fit your needs. Now let's take a look at the **FPSController**'s inspector: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F2akmIoVE3QdQriwFU5k7%252Fimage.png%3Falt%3Dmedia%26token%3Dcd8afb8b-b138-4c5f-a7f8-96281c83c4e3&width=768&dpr=3&quality=100&sign=ddffe132&sv=2) FPSController inspector. circle-check **Tip:** make sure to add the component to the character root game object. This scripts manually rotates character for turn-in-place feature, so it is crucial that the whole player is rotated. The component does not contain the data itself, instead, it uses an FPSControllerSettings asset. To create such an asset, right click and go to **Create -> FPS Animator demo -> FPSControllerSettings:** ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FlMOCvTi9bLEVos3dcfaA%252Fimage.png%3Falt%3Dmedia%26token%3D382c2a5b-a64f-4b60-b461-3bd0c816d505&width=768&dpr=3&quality=100&sign=849c95f1&sv=2) Controller settings. Specfiy the **Rig Asset**, as we will use it to select bones in the Weapon section. Select the asset we created previously in the [Character Rig](https://kinemation.gitbook.io/scriptable-animation-system/workflow/character-rig) section. Animation Controller Weapon **Unarmed Profile:** this profile will be used when toggling the unarmed state. **Turn In Place Angle:** if player exceeds this value, a turn will be performed. **Turn Curve:** defines how the turn will be applied. **Turn Speed:** the playback of the turning animation. **Time Scale:** controls the real time scale. **Equip Delay:** defines the delay time for the next weapon to be equipped. **Lean Angle:** the max leaning angle in degrees. **Sensitivity:** mouse input sensitivity scale. **WeaponBone**: all weapons will be parented to this element. Just select the IK WeaponBone here. **Prefabs:** defines all the weapon prefabs the system will spawn when the game starts. As the demo project leverages Unity New Input System, you can find an Input Action asset in the **Assets/Demo/Settings** folder: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FbvszP2nu7crI6q91ZcSF%252Fimage.png%3Falt%3Dmedia%26token%3D7873da01-87e8-43da-8400-0176eba7f005&width=768&dpr=3&quality=100&sign=f2a8050d&sv=2) PlayerControls. It already has all the important actions, and you can customize it according to your project needs. triangle-exclamation **Note 2024-04-26:** the turn-in-place feature has been recently disabled in the demo project. A completely new system is coming soon. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller#fpsmovement) FPSMovement ------------------------------------------------------------------------------------------------------------------------- This script translates the character, controls its speed, pose and movement state: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FNlkBnERFmYZxWKsUeA2f%252Fimage.png%3Falt%3Dmedia%26token%3D4d828b45-3a3b-460d-a611-08a38ab7dec3&width=768&dpr=3&quality=100&sign=385e00aa&sv=2) Movement component. Make sure to specify the Movement Settings - they define the speed of each state, smoothing and other locomotion settings: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FCz4hE839Uga404r5kBFU%252Fimage.png%3Falt%3Dmedia%26token%3D562be5c4-2af7-43c9-8ba3-6a50a25dffe4&width=768&dpr=3&quality=100&sign=41397230&sv=2) Movement settings. **Idle/Prone/Crouching/Walking/Sprinting** are movement states, which only contain the velocity and velocity smoothing properties. **Crouch Ratio** will be multiplied by the player's standing height. For example, if set to 0.5 the player's height will be decreased twice when crouching. **Air Friction** defines how controllable our player is when in the air. 1 means 100% controlled, and 0 means no movement input is applied. **Air Velocity** defines the movement speed multiplier when in air. **Max Fall Velocity** defines the max vertical velocity. **Slide Curve** is a delta curve, applied when sliding. **Slide Direction Smoothing** controls the rotation smoothing when sliding. **Slide Speed** controls the general velocity when sliding. [PreviousResourceschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/resources) [NextWeapons and Itemschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/weapons-and-items) Last updated 1 year ago * [FPSController](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller#fpscontroller) * [FPSMovement](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller#fpsmovement) --- # Animator Profiles | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#legacy-system) Legacy system ------------------------------------------------------------------------------------------------------------------------------------ In previous versions of the **FPS Animation Framework**, we had a fixed amount of animation layers, specified directly in the **FPSAnimator** component: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FRG8I0iRH8lTiZw99SIEK%252Fimage.png%3Falt%3Dmedia%26token%3D75f3346a-a6a9-4160-b098-d4ecfe1cf422&width=768&dpr=3&quality=100&sign=dae5b9b4&sv=2) Legacy system. The problem with this design is obvious - scalability. What if we want to add an unarmed state? Or maybe swimming? What if we want a unique animation feature for this specific weapon? The new **Scriptable Animation System** eliminates this problem by introducing a dynamic linking system for animation features. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#dynamic-linking) Dynamic Linking ---------------------------------------------------------------------------------------------------------------------------------------- This concept is incredibly simple - animation feature encapsulation. To achieve this, the new system relies on **Animator Profiles**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FF5vXZqjMh33zXt63GqMY%252Fimage.png%3Falt%3Dmedia%26token%3D0b260e23-b4e6-4f8c-a089-744311b47038&width=768&dpr=3&quality=100&sign=d9a72b94&sv=2) Profiles! An **Animator Profile** is a Scriptable Object, that contains procedural animation features (**FPSAnimatorLayerSettings**). There are no limitations on how to use a profile. Whether it is a weapon, item, or a climbing state - it is possible to add custom features required for a specific gameplay scenario. circle-check **Example:** imagine you want to add a ladder-climbing feature. You don't need Aiming or Recoil animation layers in this case. So you can create a new profile, which will include the features you need for this specific climbing state. Here is how to link a new animator profile: In this example, we dynamically link an **Animator Profile** from the currently equipped weapon. For items and weapons, there's a special component called **FPS Animator Entity**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FNXSOxD5lCPuGUVueWW1F%252Fimage.png%3Falt%3Dmedia%26token%3Df1227f8b-2d6b-414a-a106-fdd82b2ae441&width=768&dpr=3&quality=100&sign=2176d1b5&sv=2) Entity can be a weapon or an item. This is just a data component, that contains an **Animator Profile** and a _Default Aim Point_ transform (the [Ads Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer) uses it). [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#procedural-animation-features) Procedural Animation Features -------------------------------------------------------------------------------------------------------------------------------------------------------------------- A procedural animation feature consists of 2 entities: * **Animation Layer Settings**: a Scriptable Object that contains feature data. * **Animation Layer Job**: a struct that runs the procedural animation logic. circle-check **Tip**: separating data and execution entities makes the workflow more convenient. We can modify the data and see the runtime changes. It is also essential for Version Control since managing data assets is quite simple. **Animation Layer Settings** asset is also responsible for instantiating a new **Animation Layer Job** when a new **Animator Profile** is linked. This is how it is handled in code: [PreviousFramework Architecturechevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/framework-architecture) [NextAnimator Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer) Last updated 1 year ago * [Legacy system](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#legacy-system) * [Dynamic Linking](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#dynamic-linking) * [Procedural Animation Features](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles#procedural-animation-features) FPSController.cs Copy private void EquipWeapon() { ... _fpsAnimator.LinkAnimatorProfile(gun.gameObject); ... } FPSBoneController.cs Copy protected void LinkAnimationLayers() { foreach (var setting in _newProfile.settings) { var job = setting.CreateAnimationJob(); if (job == null) continue; job.Initialize(_layerJobData, setting); job.UpdateEntity(_entity); var playable = job.CreatePlayable(_playablesController.playableGraph); _animationLayers.Add(new AnimationLayer() { job = job, playable = playable }); } } --- # Welcome! | PRAS Documentation circle-check **Latest version**: 2024.1.0 as of December 3d, 2024. [**Showcase**arrow-up-right](https://redirect.epicgames.com/?redirectTo=https://youtu.be/EFNfkMBUuCA) **•** [**Free Demo**arrow-up-right](https://drive.google.com/file/d/1cAFou2Gf5_HhbfHjrHpKBdxLD9vAP1Ch/view?usp=drive_link) **•** [**Discord**arrow-up-right](https://discord.gg/kinemation-1027338787958816860) **Procedural Recoil Animation System (PRAS)** is the most advanced recoil solution for Unreal Engine. This documentation will provide you with essential info on how the system works and how to implement it in your Unreal project. circle-check **Tip**: make sure to join our [Discordarrow-up-right](https://discord.gg/kinemation-1027338787958816860) and [YouTubearrow-up-right](https://www.youtube.com/@kinemationstudio) to stay tuned! Video showcase. [NextRecoil Animationchevron-right](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation) Last updated 1 year ago --- # Input System | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#overview) Overview --------------------------------------------------------------------------------------------------------------------- The **FPS Animation Framework** introduces a standalone input property system. The idea is that you can define custom properties in the **Input Config** asset and then use them in runtime: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FLM1ZYRnO4WNzlGinr78s%252Fimage.png%3Falt%3Dmedia%26token%3D474dc36c-20b0-441e-b5de-ed679fb934d2&width=768&dpr=3&quality=100&sign=a3c491a6&sv=2) Example input config asset. Once the game starts, the **User Input Controller** will register all the properties from the **Input Config**, so they can be modified in runtime. So far only 4 types are supported: * Int * Float * Bool * Vector4 circle-check **Tip:** floats have an interpolation feature. Set the interpolation speed to something higher than 0, and the system will automatically interpolate the value in realtime. This is a useful function for weights, when you want to smoothly disable/enable some animation features. The framework provides a default **Input Config**, which you can use as a starting point: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FgXgrqnVN61MNVemUL4RP%252Fimage.png%3Falt%3Dmedia%26token%3D54c1b665-dbb0-4a4e-8b73-e2a98fe1e087&width=768&dpr=3&quality=100&sign=cadb777d&sv=2) Default asset. To get or set values in runtime, you can use these methods: While it is possible to get/set a property by name, it is recommended to use the property index instead. You can get the property index in the **Start()** event like this: Now let's learn what parameters control what in the default Input Config. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#default-properties) Default Properties ----------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#float-properties) Float properties * **PlayablesWeight** \- controls the weight of the custom animations. * **StabilizationWeight** - controls the stability of the upper body. If set to 1 - fully stabilized, if 0 - overidden locally, stability is not guaranteed. * **LeanInput** \- defines the lean angle. Used in the Look Layer. * **Aiming Weight** - controls the weight of the ADS. It is modified in the Ads Layer, and used in the View Layer. * **TurnOffset** \- controls the character rotation offset to counter player rotation (it is used sed for turning in place). ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#bool-properties) Bool properties * **IsAiming** - defines the current state of aiming. * **UseFreeAim** - whether we use the dead-zone mechanic or not. Only used in the Sway Layer.- ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#vector4-properties) Vector4 properties * **MouseInput** - defines accumulative mouse look input. X is the yaw rotation, while Y is the pitch rotation. Z and W components are not used. Primarily used by the Look Layer. * **MouseDeltaInput** - defines the delta mouse look input. X is the yaw delta rotation, while Y is the pitch delta rotation. Only used by the Sway Layer. * **MoveInput** - defines the current movement input. X represents the horizontal movement, and Y - is horizontal. Used by the Sway Layer. [PreviousAnimator Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer) [NextAnimator Layerschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers) Last updated 1 year ago * [Overview](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#overview) * [Default Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#default-properties) * [Float properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#float-properties) * [Bool properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#bool-properties) * [Vector4 properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system#vector4-properties) Copy // Where T is your custom type. public virtual T GetValue(int propertyIndex) public virtual T GetValue(string propertyName) public virtual void SetValue(string propertyName, object value) public virtual void SetValue(int propertyIndex, object value) Copy private UserInputController _inputController; private int _myPropertyIndex; private void Start() { _inputController = GetComponent(); _myPropertyIndex = _inputController.GetPropertyIndex("yourPropertyName"); } --- # Rig | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#kinemation-rig) Kinemation Rig ------------------------------------------------------------------------------------------------------------------------ The **Scriptable Animation System** introduces a new way of storing the information about the character skeleton hierarchy - Rig Assets. **Rig Asset** is a Scriptable Object, which contains: * Character Skeleton hierarchy * Element Chains * Animation Curves To create a new **Rig Asset Right click -> KINEMATION -> Rig:** ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FwRRrDpDNycKAC4afBm9u%252Fimage.png%3Falt%3Dmedia%26token%3D9cc914f7-b18c-486b-87af-c58e1ed4ad02&width=768&dpr=3&quality=100&sign=65dbc3b6&sv=2) Rig Asset. In order to update the character skeleton hierarchy, it's required to provide a **K Rig Component** reference. To do this, attach the **K Rig Component** to the root bone of the skeleton hierarchy: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F1hoLjw04ENK8zgGzITZE%252Fimage.png%3Falt%3Dmedia%26token%3Dbdc33277-457c-464f-bef4-439f22e8787a&width=768&dpr=3&quality=100&sign=da6e21b0&sv=2) **Rig Component** will iterate over all child transforms of the root bone and include them in the hierarchy collection. Then, you you will need to specify the **Rig Component** reference in your desired **Rig Asset** and hit the _Import Rig_ button/ The **Rig Asset** does not store the Transform references, instead, it has a List of **KRigElements** - a struct which has a name and an **index** of the element in the hierarchy. Then, you can retrive the Transform reference based on the **KRigElement**: Thanks to this system we can select bones we want to modify in the data assets without holding a reference to the bone! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#practical-example) Practical Example ------------------------------------------------------------------------------------------------------------------------------ The Rig Asset has another cool feature - automated bone selection. If you want to select a bone from the pop-up window in your custom script, make sure to implement the **IRigUser** interface: The only method this interface provides is GetRigAsset - it will be used by a custom drawer to select a rig element. Now, simply add a KRigElement to your script: Now when you get back to the Editor, you will be able to select an element from the hierarchy. This concept is used for **Animator Layer Settings** and other entities in the framework. And in the next section we will learn about the new layer system! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#krigelement) KRigElement ------------------------------------------------------------------------------------------------------------------ This struct represents the element in the hierarchy: **Rig Elements** are visually represented as selectable widgets in Rig Asset, Animator Layers and other scripts: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FS65NSdOvX72s23sYOBxo%252Fimage.png%3Falt%3Dmedia%26token%3D7f17d812-4cd3-44a8-bdd8-cca772948ce2&width=768&dpr=3&quality=100&sign=1bf611fa&sv=2) Rig elements. The **Rig Element** does not represent the Transform itself, so you need to re-trieve the Transform reference via the **Rig Component**: When you select an element in the editor, the system caches the index in the hierearchy automatically. However, it is also possible to get a Transform reference by a string name only: circle-check **Tip:** Transforms re-trieved via the Rig Component are always valid, unless the index is inentionally changed in the constructor. If the Rig Element is empty, the Rig Component will return a reference to the root bone. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#kpose) KPose ------------------------------------------------------------------------------------------------------ **KPose** is a struct that represents an element pose in the **Kinemation Rig**. Let's see what fields it has: The KPose has many applications, like pose caching, blending and a convenient pose offset. For example, it is very convenient for bone modifications: [PreviousAttachment Systemchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system) [NextFramework Architecturechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/framework-architecture) Last updated 1 year ago * [Kinemation Rig](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#kinemation-rig) * [Practical Example](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#practical-example) * [KRigElement](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#krigelement) * [KPose](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/rig#kpose) AdditiveLayerState.cs Copy ... _targetBone = RigComponent.GetRigTransform(_settings.targetIkElement); ... YourCustomScript.cs Copy ... [SerializeField] private rigAsset; // Make sure to return the desired KRig asset here. public KRig GetRigAsset() { return rigAsset; } ... YourCustomScript.cs Copy ... [SerializeField] private rigAsset; [SerializeField] private KRigElement yourCustomElement; // Make sure to return the desired KRig asset here. public KRig GetRigAsset() { return rigAsset; } ... Copy public struct KRigElement { // Element name. public string name; // Index in the hierarchy. [HideInInspector] public int index; // Whether the element is an IK-object. public bool isVirtual; } Copy Transform yourTransform = RigComponent.GetRigTransform(yourRigElement); Copy Transform yourTransform = RigComponent.GetRigTransform("yourRigElementName"); Copy // The space we are going to apply the pose in. public enum ESpaceType { BoneSpace, // Current frame space. ParentBoneSpace, // The space of the parent bone. ComponentSpace, // The space of the root bone. WorldSpace // World space. } // Whether the operation is additive or absolute. public enum EModifyMode { Add, Replace } public struct KPose { public KRigElement element; // The target element. public KTransform pose; // The desired pose. public ESpaceType space; // The space we are going to operate in. public EModifyMode modifyMode; // Whether additive or replace. } KAnimationMath.cs Copy public static void ModifyTransform(Transform component, Transform target, in KPose pose, float alpha = 1f) --- # Recoil Settings | PRAS Documentation All settings are located in the **Recoil Data** asset (to create one, right-click and go **Miscellaneous -> Data Asset -> Recoil Data**). This asset contains many sections, and we will cover them one by one. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#controller-recoil) Controller Recoil --------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FtGQzxOdIBDRAdYq8pQoS%252Fimage.png%3Falt%3Dmedia%26token%3Dc7b046fd-95b0-4631-abad-a625cbfb07a5&width=768&dpr=3&quality=100&sign=b077ae51&sv=2) Controller Recoil. * **Horizontal Recoil Step**: a value will be computed in this range and added to the controller Yaw. * **Vertical Recoil Step**: a value will be computed in this range and added to the controller Pitch. * **Recoil Smoothing**: interpolation speed for X (Yaw) and Y (Pitch). * **Damping**: how fast the both Pitch and Yaw will go to zero, * **Compensation**: how much player input to take into account. 1 - 100%, 0 - 0%. **Controller Recoil** is added directly to the **Player Controller** using _AddPitchInput_ and _AddYawInput_ methods. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#curve) Curve --------------------------------------------------------------------------------------------------- This section contains curves that we covered in the previous chapter: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fuf3hCnpZyMVd7Gru8iuJ%252Fimage.png%3Falt%3Dmedia%26token%3Da0bf6c2d-e352-43b1-a343-f447802bd471&width=768&dpr=3&quality=100&sign=fba78992&sv=2) Vector curves for translation and rotation, [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#input) Input --------------------------------------------------------------------------------------------------- These properties generate main target recoil values: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FgywxkTJIaLKMl08mV8tW%252Fimage.png%3Falt%3Dmedia%26token%3Dfb4e109a-53a2-4465-b70e-a706f073f68a&width=768&dpr=3&quality=100&sign=6f4d1a4e&sv=2) Input properties. * **Pitch/Yaw/Roll Aim**: a value will be generated in this range and added to the pitch/yaw/roll when aiming. * **Pitch/Yaw/Roll**: a value will be generated in this range and added to the pitch/yaw/roll when hip firing. * **Kick/Kick R/ Kick Up Aim**: a value will be generated in this range and added in the forward/right/up direction when aiming. * **Kick/Kick R/ Kick Up**: a value will be generated in this range and added in the forward/right/up direction when aiming. It's worth noting how the random generation happens in runtime: * For 2D vectors, it will compute a value via FRandRange(X, Y) * For 4D vectors, it will compute a value via FRandRange(FRandRange(X, Y), FRandRange(Z, W)). We do it this way to avoid getting close-to-zero values, which sometimes look horrible. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#smoothing) Smoothing ----------------------------------------------------------------------------------------------------------- This group is only applied when auto/burst firing. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FsOG9EpgDj4bSl96QdvFv%252Fimage.png%3Falt%3Dmedia%26token%3D0c2cd237-3c00-466e-b57a-14dc4d25d248&width=768&dpr=3&quality=100&sign=28e2f269&sv=2) Smoothing properties. * **Smooth Rot/Loc**: interpolation speed for a rotation/translation axis. If the value is zero - no interpolation will be applied. * **Multi Rot/Loc**: multipliers for a rotation/translation axis. * **Smooth Roll**: if roll sign should change every shot. Keep it true to achieve the best results. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#noise-layer) Noise Layer --------------------------------------------------------------------------------------------------------------- This layer applies translation 2D noise in the YZ plane (right and up movement). ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252F50rKI89ROjnWH6tb1CgQ%252Fimage.png%3Falt%3Dmedia%26token%3Dc24a7703-5104-4920-b427-d7d810ed8f18&width=768&dpr=3&quality=100&sign=e437cc2&sv=2) Noise properties. * **Noise 2DTarget**: this value will be added to the translation of every shot. * **Noise 2DAccel**: interpolation speed for right and up axes. * **Noise 2DZero**: how fast each axis will go to zero. * **Noise Aim Scalar**: multiplier applied when aiming. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#pushback) Pushback --------------------------------------------------------------------------------------------------------- This layer is applied on the second shot of a burst or auto sequence. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FI8PKIOllkjMcm0XKBDlS%252Fimage.png%3Falt%3Dmedia%26token%3D4cc65807-9290-41ec-9bc2-21d4f73254aa&width=768&dpr=3&quality=100&sign=1950124a&sv=2) Pushback properties. * **Pushback**: this value will be added to the forward translation. * **Pushback Zero**: how fast the pushback should go to zero. * **Pushback Accel**: pusback interpolation speed. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#recoil-sway) Recoil Sway --------------------------------------------------------------------------------------------------------------- This layer applies sway to simulate a body recoil. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FCz7TjkOlPPylFGnIIRPp%252Fimage.png%3Falt%3Dmedia%26token%3D085af73f-496f-4f67-9522-f8d2f013557a&width=768&dpr=3&quality=100&sign=229afdb5&sv=2) Recoil Sway properties. * **Pitch Sway**: a value will be randomly generated in this range and added to the pitch. * **Yaw Sway**: a value will be randomly generated in this range and added to the yaw. * **Roll Sway Multiplier**: will multiply the yaw result by this value and add it to the roll. * **Damping**: how fast the sway should go to zero. * **Acceleration**: interpolation sway speed. * **Ads Scale**: this value will scale the recoil sway when aiming. * **Pivot Offset**: will offset the recoil physical pivot. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#timeline) Timeline --------------------------------------------------------------------------------------------------------- These properties control the general animation timeline. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FY16d7loQdXh201o1zGIC%252Fimage.png%3Falt%3Dmedia%26token%3Da18dec5e-c78a-4531-8c24-f20d68bed40e&width=768&dpr=3&quality=100&sign=87705ca7&sv=2) Tineline properties. * **Playback Offset**: will offset the loop time interval. For example, if a weapon fire rate is 600RPM, the loop interval will be 0.1s + Playback Offset. * **Play Rate**: animation speed multiplier. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#pivot) Pivot --------------------------------------------------------------------------------------------------- This section controls the physical recoil pivot point. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fw1anlwSIrkPt8CRk8wiQ%252Fimage.png%3Falt%3Dmedia%26token%3D2a12b9c3-7377-48ba-b288-1fda5afd4824&width=768&dpr=3&quality=100&sign=582c7f27&sv=2) Pivot settings. * **Pivot Offset**: applied when hip firing. * **Ads Pivot Offset**: applied when aiming. circle-check **Tip**: pivot offsets can be useful when we want to apply recoil rotation around a certain point, like a shoulder. [PreviousRecoil Animationchevron-left](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation) [NextGetting Set Upchevron-right](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up) Last updated 1 year ago * [Controller Recoil](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#controller-recoil) * [Curve](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#curve) * [Input](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#input) * [Smoothing](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#smoothing) * [Noise Layer](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#noise-layer) * [Pushback](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#pushback) * [Recoil Sway](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#recoil-sway) * [Timeline](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#timeline) * [Pivot](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings#pivot) --- # Recoil Animation | PRAS Documentation [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation#how-does-it-work) How Does It Work? --------------------------------------------------------------------------------------------------------------------------- The **PRAS (Procedural Recoil Animation System)** uses an advanced, yet simple way to generate realistic recoil. The system takes Vector Curves for translation and rotation, plays them in runtime, and uses curve values as interpolation alphas to reach the randomly generated targets. > RecoilAnimation = Lerp(0f, TargetValue, CurveValue) where **Target Value** is randomly generated when a shot is fired. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FbGyBFT8oA2snyTlu8Z2W%252Fimage.png%3Falt%3Dmedia%26token%3Dc597fb21-26e5-4a41-a303-be413e5b20f8&width=768&dpr=3&quality=100&sign=fa29ed28&sv=2) Example recoil curve. Recoil curves should be in the range \[-1;1\], so a curve value can be used as an interpolation alpha. The curve peaks at 1 and then goes down to 0 with some oscillation. circle-check **Tip**: because curves are much simpler in comparison to other methods (e.g. spring interpolation), the recoil animation is frame-rate independent. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation#single-and-auto-fire) Single and Auto Fire ---------------------------------------------------------------------------------------------------------------------------------- **Recoil Data** is an asset, which contains all information about the recoil animation. This includes curves and other settings: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fuf3hCnpZyMVd7Gru8iuJ%252Fimage.png%3Falt%3Dmedia%26token%3Da0bf6c2d-e352-43b1-a343-f447802bd471&width=768&dpr=3&quality=100&sign=fba78992&sv=2) Curve section in the Recoil Data. To create a new **Recoil Data**, right-click and go to **Miscellaneous -> Data Asset -> Recoil Data**. This asset includes 4 _Vector Curves_ in total: 2 for translation and 2 for rotation. The PRAS has 2 main fire modes: * Single * Auto/Burst (there's no technical difference animation-wise) circle-check **Tip**: we use different curves for single and auto fire because of animation quality. If we use single-fire curves when auto-firing, the animation will look choppy. To make it look smoother and more fluid we use a different set of curves. Let's compare an example single and auto fire curve: Single Auto/Burst ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fj9OuQEgdKvPOsUFSmIo0%252Fimage.png%3Falt%3Dmedia%26token%3D1956567a-ad4c-4338-9664-9a3ea89beab8&width=768&dpr=3&quality=100&sign=9e16dcba&sv=2) ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FS656FcC1900ZLIaUsT2X%252Fimage.png%3Falt%3Dmedia%26token%3D949f1a80-ef7b-4791-a2e3-5cbccb400760&width=768&dpr=3&quality=100&sign=516d1c8c&sv=2) The curves are almost identical! The only difference is that auto curve values are very close to 0 at some time - this time equals the fire rate of a weapon (in this case 600RPM = 0.1s). This will ensure that the weapon's main muzzle climbing will be fully preserved when auto-firing. triangle-exclamation **Tip**: regardless of a fire mode, the first shot is **always** a single fire shot. [PreviousWelcome!chevron-left](https://kinemation.gitbook.io/pras-documentation) [NextRecoil Settingschevron-right](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings) Last updated 1 year ago * [How Does It Work?](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation#how-does-it-work) * [Single and Auto Fire](https://kinemation.gitbook.io/pras-documentation/basics/recoil-animation#single-and-auto-fire) --- # Getting Set Up | PRAS Documentation circle-check **Tip**: make sure to already implement basic firing logic in your project. [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-1-recoil-animation-component) Step 1 - Recoil Animation Component --------------------------------------------------------------------------------------------------------------------------------------------------------------- First, it is essential to add the **Recoil Animation Component** to the character. Blueprints C++ ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252F4wyQRZRa2i08pclSWsQj%252Fimage.png%3Falt%3Dmedia%26token%3Da18eb5bc-9d03-4725-a1d1-6ed14f92dc5a&width=768&dpr=3&quality=100&sign=577c18d3&sv=2) Copy UCLASS(config=Game) class AYourCharacterClass : public ACharacter { GENERATED_BODY() public: AYourCharacterClass(); protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Recoil") TObjectPtr RecoilComponent; ... }; Then, in your character class click on the RecoilAnimation component and specify the Helper UI: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252F9Gmeeb2aeyrSNgY2rKZT%252Fimage.png%3Falt%3Dmedia%26token%3D19855adf-c124-4b72-8197-61d089727171&width=768&dpr=3&quality=100&sign=cdbef493&sv=2) Select this blueprint. The Helper UI is useful when you want to modify the recoil values in runtime in a very convenient way: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FLRJ92IQm7scBIPm2Ggci%252Fimage.png%3Falt%3Dmedia%26token%3Dca8d9f41-ad58-467a-aaf1-dfe2acf7f97e&width=768&dpr=3&quality=100&sign=b6d1406&sv=2) To enable this Helper UI in the game you can use the Blueprint-exposed methods: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FSKhTkMdSkG87OHj1IOBh%252Fimage.png%3Falt%3Dmedia%26token%3Df9e799a4-7c55-4a5c-a947-b6fe0c53a845&width=768&dpr=3&quality=100&sign=78c847&sv=2) How to use helper UI. [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-2-initialize-and-play) Step 2 - Initialize and Play ------------------------------------------------------------------------------------------------------------------------------------------------- Make sure to call the `Init` method of the **Recoil Animation Component** to initialize the recoil animation: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FNGo3aI0bJbI5aiaxiC3O%252Fimage.png%3Falt%3Dmedia%26token%3D57ca488f-80ac-4be5-84fc-38fe8c8a2d88&width=768&dpr=3&quality=100&sign=84b03718&sv=2) Init function. * **Data**: **Recoil Data** asset. * **Rate**: fire rate or RPM (Rounds-per-minute). * **Burst:** length of the burst sequence**.** Next, call `Play` and `Stop` methods when firing: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fwwsbla8WWkwDMOerwant%252Fimage.png%3Falt%3Dmedia%26token%3Dde35e9d4-4b22-43d3-ad21-aecf5faefa61&width=768&dpr=3&quality=100&sign=882e7ac3&sv=2) Firing logic. triangle-exclamation **Note**: Play must be called every shot! [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-3-animation-blueprint-integration) Step 3 - Animation Blueprint Integration ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Make sure to add a **Recoil Animation** node to the Anim Graph: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Ft4NrSaox5umi2XKQr6uv%252Fimage.png%3Falt%3Dmedia%26token%3D9d748092-77ba-4b30-a325-dc644d87c46d&width=768&dpr=3&quality=100&sign=1b2be20&sv=2) This node will apply recoil. If you already have an _IK_ system set up, select the _IK_ or a _VB_ (virtual bone) you want to animate with recoil in the node settings: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FCWI5cErNp3NRPB4rNvaa%252Fimage.png%3Falt%3Dmedia%26token%3Dbdaa648d-13e4-4032-a727-4baf75290c20&width=768&dpr=3&quality=100&sign=2346e0fc&sv=2) Node settings. ### [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#if-you-need-help-with-ik) If you need help with IK First, add Virtual Bones to the character head: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FKir2cdAMDEQdfBhHoMeY%252Fimage.png%3Falt%3Dmedia%26token%3D3d830ad4-5599-4786-910b-1e2e8f1f1389&width=768&dpr=3&quality=100&sign=66e18f41&sv=2) VB stands for Virtual Bone. * **VB WeaponPivot** targets ik\_hand\_gun. * **VB hand\_r** targets hand\_r. * **VB hand\_l** targets hand\_l. Add **CopyBone** nodes before the **Recoil Animation** nodes: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fw1UK9d1se7me6b0kCKdH%252Fimage.png%3Falt%3Dmedia%26token%3Dd184c38a-565f-4f8c-8c3c-92011158cdea&width=768&dpr=3&quality=100&sign=50197167&sv=2) These will copy animation from FK bones to VBs. If your animations do not keyframe the **ik\_hand\_gun** bone (it is used for baking gun movement into the character animation), you will have to use **hand\_r** as a source bone in the first **CopyBone** node. You can additionally offset the **VB WeaponPivot** with a custom offset if you want more flexibility. Finally, use **Two Bone IK** after the **Recoil Animation** node: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FAMxlxBIIVVW97C4GAtzV%252Fimage.png%3Falt%3Dmedia%26token%3De38e011e-3271-4b84-a47b-f1e37908cdf9&width=768&dpr=3&quality=100&sign=f366a59&sv=2) IK pass. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FGo9YyPxponov5NI7JjCo%252Fimage.png%3Falt%3Dmedia%26token%3Ddc7bee46-946a-4cc7-abe9-72bbf8c12fd7&width=768&dpr=3&quality=100&sign=b354ea33&sv=2) Preferred IK settings. * * * At this point, the setup is complete. If recoil is still not playing, double-check the steps above or: * Check if **Recoil Data** has any values. * The correct bone is animated by the **RecoilAnimation**. * **Play** method is called every shot. * The **Fire Rate** is in rounds-per-minute and greater than zero. If the problem persists, feel free to post a ticket on our [Discordarrow-up-right](https://discord.gg/kinemation-1027338787958816860) . [PreviousRecoil Settingschevron-left](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings) [NextHow to implement attachmentschevron-right](https://kinemation.gitbook.io/pras-documentation/tutorials/how-to-implement-attachments) Last updated 1 year ago * [Step 1 - Recoil Animation Component](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-1-recoil-animation-component) * [Step 2 - Initialize and Play](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-2-initialize-and-play) * [Step 3 - Animation Blueprint Integration](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#step-3-animation-blueprint-integration) * [If you need help with IK](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up#if-you-need-help-with-ik) --- # How to implement attachments | PRAS Documentation [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/how-to-implement-attachments#overview) Overview ------------------------------------------------------------------------------------------------------------------------- To modify the current recoil animation, **PRAS** has the Input Scale feature using these methods: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FONnChPSmiaEpMSgWqprq%252Fimage.png%3Falt%3Dmedia%26token%3D015fe425-65cd-47bf-9d32-95ecd43da4ad&width=768&dpr=3&quality=100&sign=9576a580&sv=2) Input Scale methods. * **Scale Input**: applies an Input Scale. * **Unscale Input**: reverts an Input Scale. * **Reset Input Scale**: resets any applied modifiers. **Input Scale** is a struct that includes these properties: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fbe7QHNIcM9MlybwhiO1c%252Fimage.png%3Falt%3Dmedia%26token%3D1d6e8b3e-0656-430d-a4d8-347c0b8ddcfd&width=768&dpr=3&quality=100&sign=78616140&sv=2) Input Scale properties. [hashtag](https://kinemation.gitbook.io/pras-documentation/tutorials/how-to-implement-attachments#use-case) Use-case ------------------------------------------------------------------------------------------------------------------------- When attachment is equipped, make sure to update the current Input Scale: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FnSh2cWXb85lRyJ24NYkN%252Fimage.png%3Falt%3Dmedia%26token%3D485fd882-3569-44ff-92f1-f7d357622a4a&width=768&dpr=3&quality=100&sign=358a0ae4&sv=2) How to scale recoil. To revert changes of the previous attachment: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fnt7YFCLhUpqAPD7EtkJQ%252Fimage.png%3Falt%3Dmedia%26token%3D06d3d633-5722-4016-af3a-698abfed3e96&width=768&dpr=3&quality=100&sign=47f3f880&sv=2) How to revert recoil scale. [PreviousGetting Set Upchevron-left](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up) Last updated 8 months ago * [Overview](https://kinemation.gitbook.io/pras-documentation/tutorials/how-to-implement-attachments#overview) * [Use-case](https://kinemation.gitbook.io/pras-documentation/tutorials/how-to-implement-attachments#use-case) --- # Animator Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer#overview) Overview ----------------------------------------------------------------------------------------------------------------------- An **Animator Layer** is a procedural animation feature, which modifies your character pose in realtime. circle-check **Tip:** usually animator layers reside in the **Animator Profile**. The only exception is the **IK Motion Laye**r - this layer counts as an "animation", so you can dynamically link it using: Copy _fpsAnimator.LinkAnimatorLayer(yourLayerHere) You can find out more in this section: All layers in the framework has a similar structure, let's take a look at it: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FVMJ2fP1O7i8qq5Ie9CMD%252Fimage.png%3Falt%3Dmedia%26token%3Ddec48698-60f6-47ce-af61-15c1e82417c7&width=768&dpr=3&quality=100&sign=2d5a5082&sv=2) AttachHandLayer Example. The red highlighted area represents general settings for all animator layers. Let's break them down: * **Alpha**: controls the influence of the layer; if set to 1 - the layer will be fully applied, and if set to 0 - it will be disabled. * **Link Dynamically** - defines if this layer will need to be cached when a new profile is linked. If set to true, there will be no smooth blending, but instead the settings will be updated. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer#curve-blending) Curve Blending ----------------------------------------------------------------------------------------------------------------------------------- **Curve Blending** is a crucial part of controlling animation features in realtime. You can select a parameter which will control the layer, so far the system supports these parameter types: * Animator Controller float parameters. * Playables curves. * Input Config variables. You can also specify the **Blend** parameter, which can be either **Mask** or **Direct**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F6BvgtPpudrX92tcNqWvk%252Fimage.png%3Falt%3Dmedia%26token%3D576391fc-89fe-4e3d-ba63-644079b325de&width=768&dpr=3&quality=100&sign=16cfd0d6&sv=2) Mode options. * **Mask** means that the value will be applied in reversed mode, computed via: **result = 1f - value.** For example, if the parameter value is 1, the final value will be 0. * **Direct** mode is going to use the parameter value as is. If the value is 1, the final result will be 1. It is possible to specify multiple **Curve Blends** in the list, where the top index item will overrides previous ones. **For example**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FzsypR3BjfIxozmXCTLFo%252Fimage.png%3Falt%3Dmedia%26token%3D685be9e9-85ec-4099-8229-3aa131a53974&width=768&dpr=3&quality=100&sign=b139f4ba&sv=2) If the _FullBodyWeight_ value will be 1, the final weight will be 0. However, if P_roneWeight_ is 0, the final result will be 0 as well. [PreviousAnimator Profileschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-profiles) [NextInput Systemchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/input-system) Last updated 1 year ago * [Overview](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer#overview) * [Curve Blending](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layer#curve-blending) --- # Aiming doesn't work | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work#reason) Reason ---------------------------------------------------------------------------------------------------------- The system does not allow linking the same Animator Profile more than once. If your default Animaotr Profile is the same as the one you are trying to link, the aim point transform won't be updated. As a result, aiming will not function properly. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work#solution) Solution -------------------------------------------------------------------------------------------------------------- Locate the **FPS Animator** component and set its default **Animator Profile** to "None": ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F4Gon8CTa0JSsnCRD3lEG%252Fimage.png%3Falt%3Dmedia%26token%3D4546f0c3-a74f-47b2-8ad3-290ceb965771&width=768&dpr=3&quality=100&sign=d923c04c&sv=2) FPS Animator component. [PreviousWeapon is not movingchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving) [NextTwisted feet when looking left/rightchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right) Last updated 11 months ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work#reason) * [Solution](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work#solution) --- # Twisted feet when looking left/right | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252Fi0aKYArDzjy1D3T2poLG%252Fimage.png%3Falt%3Dmedia%26token%3D73204df4-ff5c-4a24-8d31-8fec200d7a46&width=768&dpr=3&quality=100&sign=17f06d2f&sv=2) [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right#reason) Reason ---------------------------------------------------------------------------------------------------------------------------- This problem is common for Humanoid characters because Unity handles IK for this animation type. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right#solution) Solution -------------------------------------------------------------------------------------------------------------------------------- To fix this problem, locate your Animator Profile, then find the IK Layer and set the "Offset Feet Targets" to true: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FbOYQPDLINbAEH0gYa0CA%252Fimage.png%3Falt%3Dmedia%26token%3D8a5125af-b4d7-4635-8be6-665f34339f52&width=768&dpr=3&quality=100&sign=8169cf4e&sv=2) Set this checkbox to true. [PreviousAiming doesn't workchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work) [NextChangelogchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog) Last updated 11 months ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right#reason) * [Solution](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right#solution) --- # New Animation Library | FPS Animation Framework 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. ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FPwe31mGno87JV48SbQAT%252Fimage.png%3Falt%3Dmedia%26token%3D03cbe436-d3ca-4b61-a98c-4284d7142927&width=768&dpr=3&quality=100&sign=e8755afc&sv=2) [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kanimationmath) 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. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kcurves) KCurves ---------------------------------------------------------------------------------------------------------------------------- Includes everything related to the curves in the framework. This includes new curve types and easing functions. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kmath) KMath ------------------------------------------------------------------------------------------------------------------------ A new library designed for general math operations. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kspringmath) KSpringMath ------------------------------------------------------------------------------------------------------------------------------------ This class implements runtime spring computation. You can use it if you wish to add a spring interpolation to your feature. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#ktransform) 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: [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kpose) 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: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FoXQDOFlJHdKpz46qHHZz%252Fimage.png%3Falt%3Dmedia%26token%3Dde2dc0b0-4da3-4ae6-bffe-74c7472effbe&width=768&dpr=3&quality=100&sign=a4f806d4&sv=2) KPose Example. **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. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#ktwoboneik) 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. [PreviousTurn Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer) [NextToolschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools) Last updated 1 year ago * [KAnimationMath](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kanimationmath) * [KCurves](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kcurves) * [KMath](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kmath) * [KSpringMath](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kspringmath) * [KTransform](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#ktransform) * [KPose](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#kpose) * [KTwoBoneIK](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library#ktwoboneik) Copy 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) --- # Weapon Layer General | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general#description) Description --------------------------------------------------------------------------------------------------------------------------------------------------- This layer can not be instantiated or used directly, instead, it serves as a general interface for weapon-related layers, like: * [Additive Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) * [Ads Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer) [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general#properties) Properties ------------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FLMtm8EV1LyAeojI6C0lG%252Fimage.png%3Falt%3Dmedia%26token%3D8fe4d337-95c9-41b5-8935-d68351a076bc&width=768&dpr=3&quality=100&sign=e085695e&sv=2) * **Weapon Ik Bone**: the actual main IK weapon bone, a parent for IK Hands. * **Right Hand Elbow**: IK Right Hint target. * **Left Hand Elbow**: IK Left Hint target. * **Hint Target Weight**: defines how much this layer will affected elbows. 1 - 100%, 0 - 0%. [PreviousAnimator Layerschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers) [NextAdditive Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general#properties) --- # Additive Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer#description) Description --------------------------------------------------------------------------------------------------------------------------------------------- **Additive Layer** has 2 main functions: weapon recoil and curve-based animations. Curve-based animations are extracted from the **WeaponBoneAdditive** Game Object, which is animated by the _Animator Controller_: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FE1qXlUTneF5mYt9jXNpC%252Fimage.png%3Falt%3Dmedia%26token%3D950f7ed8-2936-4626-a4c4-0a4dd99a6a9e&width=768&dpr=3&quality=100&sign=b7707315&sv=2) circle-check **Tip:** the demo project implements CurveEquip and CurveUnequip motions procedurally using this method. These animations only animate the WeaponBoneAdditive, so they do not affect other bones. The procedural recoil is extracted from the [Recoil Animation](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation) component. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer#properties) Properties ------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FgWQBfINw6iEE2OARCRAx%252Fimage.png%3Falt%3Dmedia%26token%3D6d46c86c-aae8-49b0-a188-c6d7c4a2bca9&width=768&dpr=3&quality=100&sign=16a585e1&sv=2) Additive Layer Settings. * **Additive Bone**: an element used to extract the additive animation. * **Interp Speed**: smoothing speed for curve animations. * **Aiming Input Property**: float property which will scale down effect of curve animations. * **Ads Scalar**: a multiplier which will scale down the curve animations influence when aiming. It is used to reduce procedural motion when aiming. [PreviousWeapon Layer Generalchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/weapon-layer-general) [NextAds Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer#properties) --- # Pose Sampler Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer#description) Description ------------------------------------------------------------------------------------------------------------------------------------------------- **Pose Sampler** is a vital part of the stabilization and IK systems. When linked, this layer will sample a pose on your character and compute crucial transforms for IK and pelvis for stabilization. triangle-exclamation **Note:** make sure this layer is applied **FIRST** in the Animator Profile! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer#properties) Properties ----------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F44TOA8mu2usgGUt2FiLP%252Fimage.png%3Falt%3Dmedia%26token%3D06c32b76-0e63-419e-bf8f-3317c314b8c6&width=768&dpr=3&quality=100&sign=25536b9a&sv=2) * **Pose To Sample**: what animation pose will be used as a base. * **Default Weapon Pose**: default weapon pose, only useful for Humanoids. * **Weapon Bone Offset**: additive offset for the IK Weapon Bone. Will offset the weapon too. [PreviousPose Offset Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer) [NextSway Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer#properties) --- # Weapon Positioning | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FuBkfHQNXuM2YNWd7rGmK%252Fimage.png%3Falt%3Dmedia%26token%3Daa48d40d-7d8b-4b92-a85e-d9fed7e27609&width=768&dpr=3&quality=100&sign=bfec58e8&sv=2) [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning#reason) Reason -------------------------------------------------------------------------------------------------------------------------- This issue happens often with Humanoid models, because most of the time humanoid animations do not update the weapon bone, and the weapon uses the default transform, which is usually the character root bone. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning#solution) Solution ------------------------------------------------------------------------------------------------------------------------------ To fix this issue, it is required to edit the **Default Weapon** property in the [Pose Offset Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer) : ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FzuoMEd7TIIAwc4RCXfYu%252Fimage.png%3Falt%3Dmedia%26token%3D2ba29347-a288-4ac0-8287-f49d7ff37089&width=768&dpr=3&quality=100&sign=481c18c&sv=2) [PreviousCan't Look Aroundchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around) [NextWeapon is not movingchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving) Last updated 1 year ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning#reason) * [Solution](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning#solution) --- # Can't Look Around | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#reason) Reason ------------------------------------------------------------------------------------------------------------------------ This issue is often related to the issues with receiving or processing player input and applying it to the character rotation. As there might be multiple possible sources of the problem, this page will provide solutios to the most common cases. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-1) Solution 1 -------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FQ1uR9y4zS7oiKDuj8xUf%252Fimage.png%3Falt%3Dmedia%26token%3D7c64f564-5f59-43a6-bb0f-094cbb6d9bde&width=768&dpr=3&quality=100&sign=9633b2a8&sv=2) Input Config asset. Make sure to add these two Vector4 properties to the **Input Config**: **MouseInput** and **MouseDeltaInput**. These properties are used by the [Look Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer) , it is also crucial to check if they are properly specified in the animator layer. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-2) Solution 2 -------------------------------------------------------------------------------------------------------------------------------- It is possible that the player input is properly processed by the system, but scaled down by the sensitivity value. To fix this make sure to add a float input property to the config: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FaCO9EGEuWTiONFgkhCrk%252Fimage.png%3Falt%3Dmedia%26token%3Dc8242580-73fc-4e92-a782-059b993262e5&width=768&dpr=3&quality=100&sign=7ee1c1ad&sv=2) [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-3) Solution 3 -------------------------------------------------------------------------------------------------------------------------------- The last solution supposes that the player input is not processed at all by the player controller. This is likely to happen if the framework is used with custom controllers, and not with the demo scripts. The input is usually updated in the controller component: [PreviousInitialization Warningschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings) [NextWeapon Positioningchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning) Last updated 1 year ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#reason) * [Solution 1](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-1) * [Solution 2](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-2) * [Solution 3](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around#solution-3) Copy private UserInputController _userInput; private void Update() { _userInput.SetValue(FPSANames.MouseDeltaInput, new Vector4(deltaMouseX, deltaMouseY)); _userInput.SetValue(FPSANames.MouseInput, new Vector4(_playerInput.x, _playerInput.y)); } --- # Collision Layer | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FhqXPKE77Lb4b6TJm4LDz%252Fimage.png%3Falt%3Dmedia%26token%3D4f1011a0-3e2e-4f56-8f66-9696ebc168dd&width=768&dpr=3&quality=100&sign=4598fa53&sv=2) Obstacle avoidance solver. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer#description) Description ---------------------------------------------------------------------------------------------------------------------------------------------- **Collision Layer** is used to avoid weapon clipping through walls or other obstacles. It works by computing the clipping part of the weapon, and then applying the blocking pose respectively. circle-check **Example:** if a weapon clips through a wall by 50%, only 50% of the pose will be applied. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer#properties) Properties -------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FS22E8s9uDpzFmkVPWkyt%252Fimage.png%3Falt%3Dmedia%26token%3Df07ccbef-25bb-4a24-a4c7-a376da81bf7e&width=768&dpr=3&quality=100&sign=2ad3b106&sv=2) * **Primary/Secondary Pose**: blocking pose applied during collision. The primary is activated when looking up, and the secondary one is activated when looking down. * **Target Spcae**: desired space to apply pose in. * **Smoothing Speed**: blocking smoothing speed. * **Layer Mask**: filter mask for raycasts. * **Ray Start Offset**: forward offset. * **Barrel Length:** total length of the ray. [PreviousAttach Hand Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer) [NextIK Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer#properties) --- # Initialization Warnings | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FqJ6YQnMAS2h2jWxGVLGB%252Fimage.png%3Falt%3Dmedia%26token%3D7bf1661c-9869-43bc-8c0f-ae8d82fa44a4&width=768&dpr=3&quality=100&sign=93bad3bc&sv=2) Example warning message. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings#reason) Reason ------------------------------------------------------------------------------------------------------------------------------- These warnings typically occur when the system fails to find target bones for IK targets. It is a common issue with skeletons, that do not use a standard naming convention for bones. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings#solution) Solution ----------------------------------------------------------------------------------------------------------------------------------- To solve this issue, it is vital to follow these steps: 1. Locate the IK Game Objects mentioned in the log. 2. Open the **Virtual Element** component. 3. Make sure it is targeting the proper bone. ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F6OHsTCsMJPgxvE0lEUlw%252Fimage.png%3Falt%3Dmedia%26token%3D7ace3b36-97df-4f47-b71e-942e049b5958&width=768&dpr=3&quality=100&sign=321a57d2&sv=2) Example for the IK Right Foot. [PreviousCamera Shakechevron-left](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/camera-shake) [NextCan't Look Aroundchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around) Last updated 1 year ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings#reason) * [Solution](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings#solution) --- # Attach Hand Layer | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FubU4Id2OjXhTuBto6kuZ%252Fimage.png%3Falt%3Dmedia%26token%3D597a20a3-9a22-49f1-825a-96ad13116fe1&width=768&dpr=3&quality=100&sign=a9c902de&sv=2) A popular use-case: Left Hand IK for attachments! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer#description) Description ------------------------------------------------------------------------------------------------------------------------------------------------ **Attach Hand Layer** is a **unique** Animator Layer, which is used to attach the character element to the weapon. The primary application of this feature is "Left Hand IK"-like behavior. However, you can also use it for the right hand as well. This layer can also be used for weapon attachments, like grips. Unlike other layers, this one can be manually created as a separate data asset by right clicking -> **Create -> KINEMATION -> FPS Animator Layers -> Attach Hand**. circle-check **Tip:** this layer does not need a target transform, as it relies on the character default pose. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer#properties) Properties ---------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FFxV8tZWeVRm7Mmja7M9a%252Fimage.png%3Falt%3Dmedia%26token%3D5662c810-d932-4736-906f-9c7a8fa0bb2e&width=768&dpr=3&quality=100&sign=5a5fdd81&sv=2) * **Custom Hand Pose:** a custom pose to override the hand bone. Useful for attachments. * **Hand Pose Offset** defines the additive offset for the attached hand. * **Override Pose Weight** defines if we need to override the fingers. * **Element Chain Name** target element chain, which will be overridden in runtime. It makes sense to specify here the hand + fingers, so your pose is the always the same. [PreviousAds Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer) [NextCollision Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer#properties) --- # Ads Layer | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F4P2mct0v4eaFEQt0eJmE%252Fimage.png%3Falt%3Dmedia%26token%3D76c8520c-463f-45c4-b350-b9b1c5671ea2&width=768&dpr=3&quality=100&sign=820f949c&sv=2) Socket-based aiming. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer#description) Description ---------------------------------------------------------------------------------------------------------------------------------------- This layer is used to align the Weapon Ik Bone with the Aim Target Bone. This layer uses 2 method to ADS: * **Absolute**: ultimately overrides the previously applied features. * **Additive:** applied on top of everthing else. You can blend between absolute and additive in Position and Rotation Blend properties. It is possible to adjust the blend factor for each rotation and translation axis. 0 means absolute, and 1 means additive. This is useful for reloading animations, which you want to have some motion while proceduraling aiming. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer#properties) Properties -------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FXiTTBdQmJzGDg9LFGP95%252Fimage.png%3Falt%3Dmedia%26token%3De165f5af-c226-45d2-add5-9cc9b7260d08&width=768&dpr=3&quality=100&sign=158ed509&sv=2) * **Aim Target Bone**: which bone we will be aligning the weapon with. Usually it is a head or a camera socket. * **Aiming Ease Mode**: smoothing function for aiming. * **Position/Rotation Blend**: absolute/absolute blend for all axes. * **Aiming Speed**: aiming general speed. * **Aim Point Speed**: interpolation speed when changing scopes. * **Is Aiming Property**: bool input property which will control the aiming state. [PreviousAdditive Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) [NextAttach Hand Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/attach-hand-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ads-layer#properties) --- # Recoil Animation | FPS Animation Framework The recoil system in the framework consists of these 3 main components: * Recoil Animation * Recoil Pattern * Camera Shake In this chapter we will cover the procedural animations, and how to create that really nice and fluid recoil. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#component) Component ---------------------------------------------------------------------------------------------------------------------------- Make sure to add the RecoilAnimation component to your character. This component will generate that smooth recoil in realtime, which will be applied by the [Additive Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) . This component has 3 main methods: Copy public void Play(); // Fired a gun, call it every shot. Copy public void Stop(); // Call it when fire key is released. Copy // Call this when a gun is equipped. void Init(RecoilAnimData data, float fireRate, FireMode newFireMode); [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#basic-properties) Basic Properties ------------------------------------------------------------------------------------------------------------------------------------------ ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FuyZlmj5KmDDLGZaR2GQI%252Fimage.png%3Falt%3Dmedia%26token%3Da7c9706c-a8a0-4f60-8c9a-12b0cc4e1d2e&width=768&dpr=3&quality=100&sign=580a6eea&sv=2) This asset contains animation curves and values for the recoil solver: Recoil Targets Smoothing Layers Misc * **Pitch** - max and min values for the pitch (up) rotation * **Roll** - max and min values for the roll rotation. * **Yaw** - max and min values for the yaw (right) rotation. **Roll and Yaw** components are Vector4. That's because of the way random values are calculated: Minimum value for **Roll and Yaw** is a random value in \[X;Y\] range, while maximum value is in \[Z;W\] range. **Aim Rot** and **Aim Loc** define multipliers for each rotation and transaltion. Applied when aiming. **Smooth Rot/Loc** - defines interpolation speed for rotation and translation. Not applied if 0. **Extra Rot/Loc** - multipliers applied in auto/burst mode only. * Noise X/Y - max and min values for position offsets along X and Y axes (right and up movement). * Noise Accel - acceleration speed. * Noise Damp - damping speed. Noise Scalar - aiming multipler. Pushback Layer Applied on the first shot of the auto or burst fire mode. * Push Amount - maximum value of the pushback. * Push Accel - acceleration speed. * Push Damp - damping speed. Hip Pivot Offset - weapon pivot offset when hip firing. Aim Pivot Offset - weapon pivot offset when aiming. Smooth Roll - if enabled, the sign of a random value for roll will change every shot. Play Rate - the speed of the recoil animation. Recoil Curves - normalized animation curves. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#recoil-curves) Recoil Curves ------------------------------------------------------------------------------------------------------------------------------------ There are 4 Vector curves in the data asset, where each Vector curve is designed to animate the rotation or translation when auto/single firing. ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FrGBTklYL9tki7KPIsgkr%252Fimage.png%3Falt%3Dmedia%26token%3Dc056ef85-9a4b-44ab-bf52-0228200a1df2&width=768&dpr=3&quality=100&sign=5c8c4a9e&sv=2) Example semi curves. circle-info **Tip:** all curves must start and end with zero! Here's the difference between auto and semi curves: Semi Auto ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F72IMzMlR69d6gbWImV3d%252Fimage.png%3Falt%3Dmedia%26token%3Dc3b25639-cead-4fc2-b5ed-283f56102054&width=768&dpr=3&quality=100&sign=89b32ccb&sv=2) ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FjcP4lOGkeZtZYqMaIsYN%252Fimage.png%3Falt%3Dmedia%26token%3D5509b438-544b-4b25-a94c-7fe5639d1f10&width=768&dpr=3&quality=100&sign=215229ae&sv=2) Curves are almost identical, the only difference is that Auto curve value is very close to zero at some point - this point is the delay between shots. > Example: let's say our fire rate is 600 RPM, then the delay between shots is 0.1s. This means, that all auto curves must be close to 0 at 0.1s time. circle-check **Tip:** this is required for the auto solver to work properly. When auto/burst mode is enbaled, the curve length is set to the fire delay (see our example above). So, the length of the auto or burst curve gets cropped to the fire delay between shots. [PreviousToolschevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools) [NextRecoil Patternchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern) Last updated 1 year ago * [Component](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#component) * [Basic Properties](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#basic-properties) * [Recoil Curves](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation#recoil-curves) --- # Weapon is not moving | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving#reason) Reason ---------------------------------------------------------------------------------------------------------------------------- If animations like idle, movement, equip and unequip are not playing, this is usually a sign of the [Additive Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/additive-layer) problem. There could be two potential issues: 1. Additive Layer is not added or set up properly. 2. Curve animations are not added or they use a different skeleton hierarchy. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving#solution) Solution -------------------------------------------------------------------------------------------------------------------------------- First, it is important to check if Additive Layer is adjusted properly: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FPhLWMeExqMgTRzFfa3YP%252Fimage.png%3Falt%3Dmedia%26token%3D151a358b-6bfb-4dd4-9f84-6b5d5cdc99e7&width=768&dpr=3&quality=100&sign=6a2f6b2d&sv=2) General settings. If the issue still occurs, then it means the issue is with curve animations. These animations are usually located in the animator controller as a separate layer: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F3kYwWuAeILr5sWaUaWTX%252Fimage.png%3Falt%3Dmedia%26token%3D8cf6efd8-8816-4cdf-9073-ef8537c0eee1&width=768&dpr=3&quality=100&sign=161693a0&sv=2) Animator Controller setup. where the curve mask only includes the **Weapon Bone Additive**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FUqbdK7KCxtZwRJDz2vMD%252Fimage.png%3Falt%3Dmedia%26token%3Dbab33795-11fd-4c9d-8c56-1e8bb1f30066&width=768&dpr=3&quality=100&sign=9f49c78a&sv=2) This bone should be manually added to the mask. To add a **Weapon Bone Additive** to a custom Avatar Mask, make sure to visit the [Tools](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools) page. Finally, it is important to check the actual curve animation bone paths: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252Fnxn6XcNq3Ksj1UbzgSyk%252Fimage.png%3Falt%3Dmedia%26token%3Dd65999ed-f5f5-4552-beb6-260f757e21a0&width=768&dpr=3&quality=100&sign=27a051db&sv=2) Default bone path. If the path in the image above does not match a character skeleton, the animation will not be played. To solve this problem, follow these steps: 1. Duplicate the curve animation. 2. Copy WeaponBoneAdditive curves from the original to the target animation [Tools](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools) . 3. Assign the animation in the animator controller. [PreviousWeapon Positioningchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-positioning) [NextAiming doesn't workchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/aiming-doesnt-work) Last updated 1 year ago * [Reason](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving#reason) * [Solution](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/weapon-is-not-moving#solution) --- # Pose Offset Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer#description) Description ------------------------------------------------------------------------------------------------------------------------------------------------ **Pose Offset** is a helpful layer, which is designed to offset the selected element. It is commonly used for adjusting IK objects for special cases, like crouching or crawling. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer#properties) Properties ---------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FR228xKiaJnmvdlPbcnup%252Fimage.png%3Falt%3Dmedia%26token%3De90520c7-94d6-47d5-b36f-29d0a4f419f5&width=768&dpr=3&quality=100&sign=96cb16ba&sv=2) * Element: the selected bone to offset. * Pose: Transform offset for this element. * Space: desired space to apply offset in. * Modify Mode: whether to Add or Replace transform. * Name: the name of the control parameter. * Mode: the Direct or Mask mode of the control parameter. [PreviousLook Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer) [NextPose Sampler Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer#properties) --- # Recoil Pattern | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern#properties) Properties ---------------------------------------------------------------------------------------------------------------------------- **Recoil Pattern** represents the controller recoil, which is added to the character and camera rotation. This type of recoil is controller by the player, so it has a practical purpose. The recoil is generated in a standalone component, make sure to add it to your character: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FweAKlKOzve4IrUVn0TbG%252Fimage.png%3Falt%3Dmedia%26token%3Da1b66345-68fc-418d-b645-c5d423829d8e&width=768&dpr=3&quality=100&sign=35e8a44&sv=2) Recoil Pattern. **Recoil Settings** define the actual recoil properties, such as damping, randomized targets for vertical/horizontal recoil, etc. **Delta Look Input Property** represents the delta input value, which is related to the User Input Controller component we added previously in [Components](https://kinemation.gitbook.io/scriptable-animation-system/workflow/components) section. Let's take a look at the **Recoil Settings**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F78AwJsy7mqxzQNXFLFN5%252Fimage.png%3Falt%3Dmedia%26token%3D78e51a25-368c-45ac-addb-3f8658c007ac&width=768&dpr=3&quality=100&sign=570ecbc2&sv=2) Recoil Pattern settings. **Horizontal/Vertical Recoil** defines the randomized range. **Horizontal/Vertical Smoothing** define the interpolation speed. **Damping** defines how fast we should return to the initial screen position. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern#integration) Integration ------------------------------------------------------------------------------------------------------------------------------ To add the recoil to your controller, make sure to grab a reference to the **Recoil Pattern** component first. Then, make sure to access the component and add the recoil to the player inut: Then, call the _Init_ method when a gun is equipped: Finally, call the _OnFireStart_ and _OnFireStop_ methods: [PreviousRecoil Animationchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation) [NextCamera Shakechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/camera-shake) Last updated 1 year ago * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern#properties) * [Integration](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern#integration) Copy if (_recoilPattern != null) { _playerInput.y += deltaMouseY; _playerInput += _recoilPattern.GetRecoilDelta(); } Copy _recoilPattern.Init(recoilPatternSettings); Copy _recoilPattern.OnFireStart(); // Call every shot. Copy _recoilPattern.OnFireEnd(); // Call when firing is cancelled. --- # Changelog | FPS Animation Framework [4.7.0 Updatechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update) [PreviousTwisted feet when looking left/rightchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right) [Next4.7.0 Updatechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update) --- # 4.7.0 Update | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#changes) Changes --------------------------------------------------------------------------------------------------------------------- * Implemented multithreading for animation features. * Complete integration of Animation Job System. * Brand new blending system. * Works out of the box. * Added control weights to the IK Layer. * Fixed the Pose Offset layer applied without curve blending. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#notes) Notes ----------------------------------------------------------------------------------------------------------------- The new update works out of the box for the most part, however some adjustments are required. ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#clean-import) Clean Import Remove the **KINEMATION** folder entirely, update the asset in the **Package Manager,** and import it to the project. ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#script-execution-order) Script Execution Order Go to **Edit -> Project Settings -> Script Execution Order** and place the _FPS Animator_ script **AFTER** your controller class (in this case it's the FPSController.cs from the demo project): ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FuKODYHO6QBqe2Zo9pfmI%252Fimage.png%3Falt%3Dmedia%26token%3Db42ace0d-16d8-4d1b-8066-958d26eb96a4&width=768&dpr=3&quality=100&sign=17b6dc98&sv=2) New order. ### [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#manual-initialization) Manual Initialization Because the FPS Animator is running after your controller now, you must manually call the `Initialize` method: [PreviousChangelogchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog) Last updated 1 year ago * [Changes](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#changes) * [Notes](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#notes) * [Clean Import](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#clean-import) * [Script Execution Order](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#script-execution-order) * [Manual Initialization](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update#manual-initialization) YourController.cs Copy private FPSAnimator _fpsAnimator; private void Start() { _fpsAnimator = GetComponent(); _fpsAnimator.Initialize(); } --- # IK Motion Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer#description) Description ---------------------------------------------------------------------------------------------------------------------------------------------- **IK Motion** is a **unique** Animator Layer. Unlike other features in the framework, this layer can be created outside of the Animator Profile. You can do it by right clicking **Create -> KINEMATION -> FPS Animator Layers -> IK Motion**. circle-check **Tip**: this layer can be used for transition motions, like a jiggling motion when aiming or leaning in the demo project. The workflow with this animation feature is this: 1. Add **IK Motion Layer** to the Animator Profile. 2. Create **IK Motion Layers** manually using the right-click method above. 3. Dynamically link desired **IK Motion Layer** using the FPS Animator component. Dynamic linking can be performed by using **LinkAnimatorLayer** method: FPSController Copy private FPSAnimator _fpsAnimator; private void DoSomething() { ... // Where `layerSettings` is your IK Motion Layer. _fpsAnimator.LinkAnimatorLayer(layerSettings); ... } [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer#properties) Properties -------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FLf8Z1UixaCqIH4HqGhgT%252Fimage.png%3Falt%3Dmedia%26token%3Dd1aefb68-6f8a-4c1f-8364-cae19917cbf5&width=768&dpr=3&quality=100&sign=f3b52fd5&sv=2) IK Motion Layer Settings. * **Bone To Animate**: character bone which will be animated procedurally. * **Rotation/Translation Curves**: curves which will animate each axis of rotation/translation. * **Rotation/Translation Scale**: will scale each axis of rotation/translation. * **Blend Time**: time in seconds to blend in this motion. * **Play Rate**: playback speed for this animation. [PreviousIK Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer) [NextLook Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer#properties) --- # Look Layer | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FeXQGiWkuhqULWwlZ9P6m%252Fimage.png%3Falt%3Dmedia%26token%3D003e7024-29ae-4057-b2c8-b2172f4f271c&width=768&dpr=3&quality=100&sign=451d5d1b&sv=2) Simple look around and leaning. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer#description) Description ----------------------------------------------------------------------------------------------------------------------------------------- **Look Layer** replaces [**Blend Trees**arrow-up-right](https://docs.unity3d.com/Manual/class-BlendTree.html) when it comes to looking around. It procedurally rotates bones of your character to make it look around. The layer supports all rotation axes. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer#properties) Properties --------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FdCDvUe2xRllSgu49jmjz%252Fimage.png%3Falt%3Dmedia%26token%3Df35c82e0-7aa1-494e-8025-05a3282ffd8f&width=768&dpr=3&quality=100&sign=eb8bfd26&sv=2) * Mouse Input Property: what input Vector4 value will be controlling the Pitch and Yaw input. * Lean Input Property: what value will be controlling leaning angle. * Pitch/Yaw/Roll Offset Elements: what bones will be applying Pitch/Yaw/Roll rotations. **Pitch** represents rotation around the X axis or up/down motion. **Yaw** represents rotation around the Y axis or right/left motion. **Roll** represents rotation around the Z axis or leaning motion. [PreviousIK Motion Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer) [NextPose Offset Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-offset-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer#properties) --- # IK Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer#description) Description --------------------------------------------------------------------------------------------------------------------------------------- This layer applies Two Bone IK algorithm based on the specified bones. The layer utilizes Unity Jobs system for a faster IK evaluation. This layer is supposed to be the last one in the profile. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer#properties) Properties ------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FGUXOwYli5kkZRrBzPzhd%252Fimage.png%3Falt%3Dmedia%26token%3D8d862e1f-2a9d-4022-8b8e-551088d1d4fe&width=768&dpr=3&quality=100&sign=350a88cf&sv=2) IK postfix means the target object for the bone. Hint postfix means the pole target, or the in-between bone, like knee or lowerarm/elbow. [PreviousCollision Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/collision-layer) [NextIK Motion Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-motion-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/ik-layer#properties) --- # Tools | FPS Animation Framework The FPS Animation Framework offers helpful editor tools. All tools are available in the **FPS Animator/Tools**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FIeBLsMIBLEc46s4Mm5Pn%252Fimage.png%3Falt%3Dmedia%26token%3D57528631-0a50-4686-82fa-ecf63510d60f&width=768&dpr=3&quality=100&sign=a0b8cf3a&sv=2) Click the Tools button. Now let's see the very details of each editor tool. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#ik-extractor) IK Extractor ---------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FJoSdjonlgL5Dgo9kipND%252Fimage.png%3Falt%3Dmedia%26token%3D9b384d25-8974-48d2-9323-ee7c47397f5d&width=768&dpr=3&quality=100&sign=8e61ecfb&sv=2) IK Extractor tool. This tool copies the animation data from the selected to the target bone. This is particularly useful for procedural curve animations, where we want to copy the data from the weapon bone to the additive bone. This tool computes the additive animation, by "substracting" the the first frame of the Reference Animation from the Target Animation frames. You can also adjust the Rotation Offset - this property will add extra rotation to all frames. * **Target Animation**: the animation we want to copy the data to. * **Reference Animation**: the first frame of this animation will be used as a base for additives. * **Root**: the root bone of the hierarchy. Note: it is not includes in the bone path! * **From**: the bone to copy from. * **To**: the bone to copy to. * **Rotation Offset**: additive offset for the final result. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#copy-bone-modifier) Copy Bone Modifier ---------------------------------------------------------------------------------------------------------------------------------- This tool copies animation data from one bone to another: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FG03Dh095wfmVSLbYfS0s%252Fimage.png%3Falt%3Dmedia%26token%3D2130a660-e93e-4b2d-9247-de73025c6a75&width=768&dpr=3&quality=100&sign=48827807&sv=2) It copies the animation data. That's it. * **Source Animation**: the animation to copy from. * **Target Animation**: the animation to copy to. * **Source Root**: the root bone of the source animation. * **Source Tip**: the target bone of the source animation. * **Target Root**: the root bone of the target animation. * **Target Tip**: the bone to copy to in the target animation. It is possible to use this tool to copy the data between completely different animations, that might have different hierarchies. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#avatar-mask-modifier) Avatar Mask Modifier -------------------------------------------------------------------------------------------------------------------------------------- This tools allows you to add custom bones and game objects to the avatar mask. This is especially useful within the context of this framework, as we have to animate custom game objects, which are not part of the original skeleton hierarchy (e.g. WeaponBoneAdditive): ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F5C5dsQoZCMRFRtI7hIgu%252Fimage.png%3Falt%3Dmedia%26token%3Da9d8135a-129e-4e3a-affd-27dda3cb6243&width=768&dpr=3&quality=100&sign=6c7864dd&sv=2) Avatar Mask modifier. * **Root**: the root bone of the hierarchy. * **Bone To Add**: the target bone/game object you want to add. * **Upper Body Mask**: the target avatar mask. Add your character to the scene, assign the Transform references and the avatar mask. [PreviousNew Animation Librarychevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library) [NextRecoil Animationchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-animation) Last updated 1 year ago * [IK Extractor](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#ik-extractor) * [Copy Bone Modifier](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#copy-bone-modifier) * [Avatar Mask Modifier](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/tools#avatar-mask-modifier) --- # View Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer#description) Description ----------------------------------------------------------------------------------------------------------------------------------------- **View Layer** plays an important role in adjust first-person view. The layer allows to work directly with IK Weapon and Hand targets in a convenient way. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer#properties) Properties --------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FoR1uqfQWXm70hO63ZGTf%252Fimage.png%3Falt%3Dmedia%26token%3D0c9e9eaa-2476-4ea1-b637-45cb4de1865b&width=768&dpr=3&quality=100&sign=1d509353&sv=2) IK Hand Gun, IK Hand Right and IK Hand Left are all KPoses - a special struct that defines how the bone will be modified: * **Element**: target bone. * **Pose**: Transform pose to apply. * **Space**: space to apply the Pose in. * **Modify Mode**: whether we want to accumulate or replace Pose. [PreviousSway Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer) [NextBlending Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer#properties) --- # Sway Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer#description) Description ----------------------------------------------------------------------------------------------------------------------------------------- **Sway Layer** is responsible for applying movement, aiming and dead-zone sway effects to your weapon. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer#properties) Properties --------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F5RUz89tCMgua1qD3JKQF%252Fimage.png%3Falt%3Dmedia%26token%3D436dd8b8-7001-4684-a398-a4dba44d56ee&width=768&dpr=3&quality=100&sign=dcad74a&sv=2) Sway Layer Settings **Free Aiming:** * **Head Bone:** this element will be used to rotate around to achieve dead zone aiming. * **Free Aim Clamp**: max free aim value. * **Free Aim Interp Speed**: smoothing speed for free aiming. * **Free Aim Input Scale**: free aim sensitivity. * **Free Aim Space**: the space to apply in. * **Free Aim Space**: what space the effect will be applied in. * **Use Free Aim Property**: a bool input property which will enable or disable free aiming. **Move/Aim Sway:** * **Damping**: damping factor in range \[0;1\]. * **Stiffness**: oscillation factor in range \[0;1\]. * **Speed**: spring interpolation speed. * **Scale**: global spring effect scale. * **Target Damping Speed**: how it will go to zero. * **Sway Space:** the space where a sway effect will be applied. * **Move Input Property:** a Vector4 input property that will define the user's local movement direction. * **Mouse Delta Input Property:** a Vector4 input property that defines delta input from the mouse. [PreviousPose Sampler Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/pose-sampler-layer) [NextView Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer) Last updated 10 months ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/sway-layer#properties) --- # Turn Layer | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FSv6WArGRoO6x9ZLVjIJE%252Fimage.png%3Falt%3Dmedia%26token%3Df128111a-732f-4955-ad9a-0942ab7841e9&width=768&dpr=3&quality=100&sign=d6afecee&sv=2) Easy turn in place feature. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer#description) Description ----------------------------------------------------------------------------------------------------------------------------------------- **Turn Layer** is a **unique** animation feature, which is designed to make the character turn in place if yaw angle is exceeded. Unlike many implementations, this layer does not make any changes to the character rotation logic. circle-check **Note**: this layer works with [Look Layer](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/look-layer) . It is required to add a **TurnOffset** float property to the **Input Config**. This value will be used by the r to adjust the yaw rotation of the character: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FsfQk1mR6LsO73kvYWXGH%252Fimage.png%3Falt%3Dmedia%26token%3Dad31e2bb-78ac-4d42-ab1a-80523c2abfa3&width=768&dpr=3&quality=100&sign=67a78595&sv=2) Then, the **Turn Layer** must be added in the end of the **Animator Profile.** The layer itself will be rotating the character root bone against the controller rotation, which will make the player stay in place. The next step is to make the Look layer use the **TurnOffset** property: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F5pPgcK5Ql5mTkaIpJ3NJ%252Fimage.png%3Falt%3Dmedia%26token%3D1061f01e-c546-4bb2-a25c-d8e1d88d6258&width=768&dpr=3&quality=100&sign=7b4f684a&sv=2) Finally, **TurnLayer** settings need to be adjusted. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer#properties) Properties --------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FWncFg0tZkoNiads2MKuc%252Fimage.png%3Falt%3Dmedia%26token%3Ddb16d2dc-ddf5-4c81-ba20-0d55238a1fe9&width=768&dpr=3&quality=100&sign=860a9f59&sv=2) Turn Layer Settings. * **Character Root Bone**: this is the top bone in the skeleton hierarchy. * **Angle Threshold**: maximum allowed yaw rotation. If this value is exceeded, the turn will be performed. * **Turn Curve**: defines the easing of the turning value. * **Turn Speed**: the speed of the character turning. * **Turn Input Property**: the turn offset value. It will be modified by the turn layer, and will be read by the Look layer. * **Animator Turn Right/Left Trigger**: names of animator triggers, which will play the turning animation. These properties are optional, and only required if there are turning animations in the controller. In order to use custom turning animations, it is crucial to specify them in the **Animator Controller**: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F81q48RMYY0cLT3OwQZzK%252Fimage.png%3Falt%3Dmedia%26token%3D11d11f0c-939d-40a1-9935-43d891ab65e1&width=768&dpr=3&quality=100&sign=8eb6006&sv=2) These animations are usually played via a trigger property, which is set in the **Turn Layer**. [PreviousBlending Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer) [NextNew Animation Librarychevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/new-animation-library) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer#properties) --- # Blending Layer | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer#description) Description --------------------------------------------------------------------------------------------------------------------------------------------- **Blending Layer** is used to fix strange-looking poses using a fully procedural method. This layer is easy to use and adjust for your characters, as it doesn't require any special setup or integration. It is possible to use multiple **Blending Layers** in the Animator Profile. It is great when you want to adjust multiple different states, like standing or crouching for example. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer#properties) Properties ------------------------------------------------------------------------------------------------------------------------------------------- ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FdLpOP0FE11UQ8TzM4rDy%252Fimage.png%3Falt%3Dmedia%26token%3Ddc6dc7e3-3fdb-4463-8d3d-701facecc127&width=768&dpr=3&quality=100&sign=f9eb0e27&sv=2) * **Desired Pose**: the pose which we want to blend. Usualyl you want to specify here something that looks good visually for your desired animation state. * **Blending Elements**: a list of bones which will be affected by the blending. Also, they contain a weight which defines the influence of the blending. If value is 0 - no blending applied, and 1 - blending is full applied. * **Blend Position**: controls if we need to blend translation. Usually only rotation will do the effect, so most of the time this option should be turned off. circle-exclamation **Note:** make sure to have at least one bone which will have a weight set to 0. For example, if you blend the spine bones, make sure the head/neck element is set to 0. This will make sure the child bones won't be affected by the blending. [PreviousView Layerchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/view-layer) [NextTurn Layerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/turn-layer) Last updated 1 year ago * [Description](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer#description) * [Properties](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/animator-layers/blending-layer#properties) --- # Camera Shake | FPS Animation Framework **Camera Shake** is an important aspect of the camera animation in game. The **FPS Animation Framework** allows you to play the camera shakes in runtime, by simply accessing the **FPSCamera** component: Copy _fpsCameraController.PlayCameraShake(cameraShake); The cameraShake parameter is a Scriptable Object, which you can create by right-clicking: **Create -> KINEMATION -> FPS Animator General -> Camera Shake** ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FUWeiYTfs82BIPQXAg8ln%252Fimage.png%3Falt%3Dmedia%26token%3Dbc288395-4322-49b4-80e5-e8ee88f998f5&width=768&dpr=3&quality=100&sign=57763552&sv=2) Camera Shake. **X, Y and Z** are animation curves, which animate the respective rotation axis. **Pitch, Yaw and Roll** represent the ranges for minimum and maximum target values. The value is computed using this formula: **Smooth Speed** defines the interpolation speed. **Play Rate** defines the animation speed. [PreviousRecoil Patternchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/recoil-pattern) [NextInitialization Warningschevron-right](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/initialization-warnings) Last updated 1 year ago Copy public static float GetTarget(Vector4 value) { float a = Random.Range(value.x, value.y); float b = Random.Range(value.z, value.w); return Random.Range(0, 2) == 0 ? a : b; } --- # Rig | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals#kinemation-rig) Kinemation Rig -------------------------------------------------------------------------------------------------------------------- The **Scriptable Animation System** introduces a new way of storing the information about the character skeleton hierarchy - Rig Assets. **Rig Asset** is a Scriptable Object, which contains: * Character Skeleton hierarchy * Element Chains * Animation Curves To create a new **Rig Asset Right click -> KINEMATION -> Rig:** ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FwRRrDpDNycKAC4afBm9u%252Fimage.png%3Falt%3Dmedia%26token%3D9cc914f7-b18c-486b-87af-c58e1ed4ad02&width=768&dpr=3&quality=100&sign=65dbc3b6&sv=2) Rig Asset. In order to update the character skeleton hierarchy, it's required to provide a **K Rig Component** reference. To do this, attach the **K Rig Component** to the root bone of the skeleton hierarchy: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F1hoLjw04ENK8zgGzITZE%252Fimage.png%3Falt%3Dmedia%26token%3Dbdc33277-457c-464f-bef4-439f22e8787a&width=768&dpr=3&quality=100&sign=da6e21b0&sv=2) **Rig Component** will iterate over all child transforms of the root bone and include them in the hierarchy collection. Then, you you will need to specify the **Rig Component** reference in your desired **Rig Asset** and hit the _Import Rig_ button/ The **Rig Asset** does not store the Transform references, instead, it has a List of **KRigElements** - a struct which has a name and an **index** of the element in the hierarchy. Then, you can retrive the Transform reference based on the **KRigElement**: AdditiveLayerState.cs Copy ... _targetBone = RigComponent.GetRigTransform(_settings.targetIkElement); ... Thanks to this system we can select bones we want to modify in the data assets without holding a reference to the bone! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals#practical-example) Practical Example -------------------------------------------------------------------------------------------------------------------------- The Rig Asset has another cool feature - automated bone selection. If you want to select a bone from the pop-up window in your custom script, make sure to implement the **IRigUser** interface: YourCustomScript.cs Copy ... [SerializeField] private rigAsset; // Make sure to return the desired KRig asset here. public KRig GetRigAsset() { return rigAsset; } ... The only method this interface provides is GetRigAsset - it will be used by a custom drawer to select a rig element. Now, simply add a KRigElement to your script: YourCustomScript.cs Copy ... [SerializeField] private rigAsset; [SerializeField] private KRigElement yourCustomElement; // Make sure to return the desired KRig asset here. public KRig GetRigAsset() { return rigAsset; } ... Now when you get back to the Editor, you will be able to select an element from the hierarchy. This concept is used for **Animator Layer Settings** and other entities in the framework. And in the next section we will learn about the new layer system! [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals#krigelement) KRigElement -------------------------------------------------------------------------------------------------------------- This struct represents the element in the hierarchy: Copy public struct KRigElement { // Element name. public string name; // Index in the hierarchy. [HideInInspector] public int index; // Whether the element is an IK-object. public bool isVirtual; } **Rig Elements** are visually represented as selectable widgets in Rig Asset, Animator Layers and other scripts: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FS65NSdOvX72s23sYOBxo%252Fimage.png%3Falt%3Dmedia%26token%3D7f17d812-4cd3-44a8-bdd8-cca772948ce2&width=768&dpr=3&quality=100&sign=1bf611fa&sv=2) Rig elements. The **Rig Element** does not represent the Transform itself, so you need to re-trieve the Transform reference via the **Rig Component**: Copy Transform yourTransform = RigComponent.GetRigTransform(yourRigElement); When you select an element in the editor, the system caches the index in the hierearchy automatically. However, it is also possible to get a Transform reference by a string name only: Copy Transform yourTransform = RigComponent.GetRigTransform("yourRigElementName"); circle-check **Tip:** Transforms re-trieved via the Rig Component are always valid, unless the index is inentionally changed in the constructor. If the Rig Element is empty, the Rig Component will return a reference to the root bone. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals#kpose) KPose -------------------------------------------------------------------------------------------------- **KPose** is a struct that represents an element pose in the **Kinemation Rig**. Let's see what fields it has: Copy // The space we are going to apply the pose in. public enum ESpaceType { BoneSpace, // Current frame space. ParentBoneSpace, // The space of the parent bone. ComponentSpace, // The space of the root bone. WorldSpace // World space. } // Whether the operation is additive or absolute. public enum EModifyMode { Add, Replace } public struct KPose { public KRigElement element; // The target element. public KTransform pose; // The desired pose. public ESpaceType space; // The space we are going to operate in. public EModifyMode modifyMode; // Whether additive or replace. } The KPose has many applications, like pose caching, blending and a convenient pose offset. For example, it is very convenient for bone modifications: KAnimationMath.cs Copy public static void ModifyTransform(Transform component, Transform target, in KPose pose, float alpha = 1f) [PreviousAttachment Systemchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/attachment-system) [NextFramework Architecturechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/fundamentals/framework-architecture) Last updated 1 year ago --- # Resources | FPS Animation Framework [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project#unity-package) Unity Package ------------------------------------------------------------------------------------------------------------------ To install demo content directly into your project, simply go to Tools/KINEMATION and download the additional content for FPS Animation Framework: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FFecw6PmUag5plvJhfGIM%252Fimage.png%3Falt%3Dmedia%26token%3D3eafd33a-bd70-4730-a388-3c98b7f492ca&width=768&dpr=3&quality=100&sign=a6caed39&sv=2) How to download demo content. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/demo-project#standalone-project) Standalone project ---------------------------------------------------------------------------------------------------------------------------- Alternatively, you get pull the latest demo version via GitHub: [![Logo](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=3&quality=100&sign=72fd77ab&sv=2)GitHub - kinemation/scriptable-animation-systemGitHubchevron-right](https://github.com/kinemation/scriptable-animation-system) Demo project repository. triangle-exclamation **Note:** the demo has dependencies on the **URP** and **Unity Input System** packages. Once you have imported the project, make sure to: * Import the framework and input system packages. * Rebuild the lighting The demo project has a very simple structure: ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FKC6Iy2tJIYQV32X8vMw5%252Fimage.png%3Falt%3Dmedia%26token%3D79bd98ac-6817-4f71-ae89-b58720f6e3e0&width=768&dpr=3&quality=100&sign=7b7a29ee&sv=2) * **Demo** folder contains the actual demo settings and scripts used with the FPS Animation Framework. You can find here prefabs, weapon examples, Animator Profiles. * **KINEMATION** folder contains the actual asset, you need to add it using Package Manager. * **Level** directory contains lighting settings and the level itself. * **Tutorials** folder includes all the materials used in our video tutorials. [PreviousExtending the Systemchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/workflow/extending-the-system) [NextControllerchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/demo-project/controller) Last updated 5 months ago --- # Initialization Warnings | FPS Animation Framework ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252FqJ6YQnMAS2h2jWxGVLGB%252Fimage.png%3Falt%3Dmedia%26token%3D7bf1661c-9869-43bc-8c0f-ae8d82fa44a4&width=768&dpr=3&quality=100&sign=93bad3bc&sv=2) Example warning message. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting#reason) Reason ------------------------------------------------------------------------------------------------------- These warnings typically occur when the system fails to find target bones for IK targets. It is a common issue with skeletons, that do not use a standard naming convention for bones. [hashtag](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting#solution) Solution ----------------------------------------------------------------------------------------------------------- To solve this issue, it is vital to follow these steps: 1. Locate the IK Game Objects mentioned in the log. 2. Open the **Virtual Element** component. 3. Make sure it is targeting the proper bone. ![](https://kinemation.gitbook.io/scriptable-animation-system/~gitbook/image?url=https%3A%2F%2F784345943-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FxcUmJ78NSw1bSUlSO9oP%252Fuploads%252F6OHsTCsMJPgxvE0lEUlw%252Fimage.png%3Falt%3Dmedia%26token%3D7ace3b36-97df-4f47-b71e-942e049b5958&width=768&dpr=3&quality=100&sign=321a57d2&sv=2) Example for the IK Right Foot. [PreviousCamera Shakechevron-left](https://kinemation.gitbook.io/scriptable-animation-system/recoil-system/camera-shake) [NextCan't Look Aroundchevron-right](https://kinemation.gitbook.io/scriptable-animation-system/troubleshooting/cant-look-around) Last updated 1 year ago --- # Changelog | FPS Animation Framework [4.7.0 Updatechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update) [PreviousTwisted feet when looking left/rightchevron-left](https://kinemation.gitbook.io/scriptable-animation-system/twisted-feet-when-looking-left-right) [Next4.7.0 Updatechevron-right](https://kinemation.gitbook.io/scriptable-animation-system/misc/changelog/4.7.0-update) --- # Recoil Animation | PRAS Documentation [hashtag](https://kinemation.gitbook.io/pras-documentation/basics#how-does-it-work) How Does It Work? ---------------------------------------------------------------------------------------------------------- The **PRAS (Procedural Recoil Animation System)** uses an advanced, yet simple way to generate realistic recoil. The system takes Vector Curves for translation and rotation, plays them in runtime, and uses curve values as interpolation alphas to reach the randomly generated targets. > RecoilAnimation = Lerp(0f, TargetValue, CurveValue) where **Target Value** is randomly generated when a shot is fired. ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FbGyBFT8oA2snyTlu8Z2W%252Fimage.png%3Falt%3Dmedia%26token%3Dc597fb21-26e5-4a41-a303-be413e5b20f8&width=768&dpr=3&quality=100&sign=fa29ed28&sv=2) Example recoil curve. Recoil curves should be in the range \[-1;1\], so a curve value can be used as an interpolation alpha. The curve peaks at 1 and then goes down to 0 with some oscillation. circle-check **Tip**: because curves are much simpler in comparison to other methods (e.g. spring interpolation), the recoil animation is frame-rate independent. [hashtag](https://kinemation.gitbook.io/pras-documentation/basics#single-and-auto-fire) Single and Auto Fire ----------------------------------------------------------------------------------------------------------------- **Recoil Data** is an asset, which contains all information about the recoil animation. This includes curves and other settings: ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fuf3hCnpZyMVd7Gru8iuJ%252Fimage.png%3Falt%3Dmedia%26token%3Da0bf6c2d-e352-43b1-a343-f447802bd471&width=768&dpr=3&quality=100&sign=fba78992&sv=2) Curve section in the Recoil Data. To create a new **Recoil Data**, right-click and go to **Miscellaneous -> Data Asset -> Recoil Data**. This asset includes 4 _Vector Curves_ in total: 2 for translation and 2 for rotation. The PRAS has 2 main fire modes: * Single * Auto/Burst (there's no technical difference animation-wise) circle-check **Tip**: we use different curves for single and auto fire because of animation quality. If we use single-fire curves when auto-firing, the animation will look choppy. To make it look smoother and more fluid we use a different set of curves. Let's compare an example single and auto fire curve: Single Auto/Burst ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252Fj9OuQEgdKvPOsUFSmIo0%252Fimage.png%3Falt%3Dmedia%26token%3D1956567a-ad4c-4338-9664-9a3ea89beab8&width=768&dpr=3&quality=100&sign=9e16dcba&sv=2) ![](https://kinemation.gitbook.io/pras-documentation/~gitbook/image?url=https%3A%2F%2F3651122009-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FmWlhCRI70uShLRiOey3T%252Fuploads%252FS656FcC1900ZLIaUsT2X%252Fimage.png%3Falt%3Dmedia%26token%3D949f1a80-ef7b-4791-a2e3-5cbccb400760&width=768&dpr=3&quality=100&sign=516d1c8c&sv=2) The curves are almost identical! The only difference is that auto curve values are very close to 0 at some time - this time equals the fire rate of a weapon (in this case 600RPM = 0.1s). This will ensure that the weapon's main muzzle climbing will be fully preserved when auto-firing. triangle-exclamation **Tip**: regardless of a fire mode, the first shot is **always** a single fire shot. [PreviousWelcome!chevron-left](https://kinemation.gitbook.io/pras-documentation) [NextRecoil Settingschevron-right](https://kinemation.gitbook.io/pras-documentation/basics/recoil-settings) Last updated 1 year ago ---