---
description: 1.4.2d
---

# Fly

## Overview

The Fly State allows the animal to fly and glide. Its State [**ID** ](../../../../scriptable-architecture/scriptables/scriptable-ids#states-ids)is **6.**&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MWS2uUmo5QT7oSKLKUt%2F-MWS3CE2YidKspA4L2U_%2FPapa-Dragon-Fly.gif?alt=media\&token=26866d8d-4ba5-4247-ab7b-2a289a2460ba)

## Creating the Fly State

To create a new Fly State Click the Plus button on the States list

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3MkgkhUX9eKXC7xlqc%2F-M3Ml29QCbxIev4MblHA%2Fimage.png?alt=media\&token=84432ffd-33df-4142-a1f9-64fda8283f4a)

Or just duplicate any of the already created Fly States Assets of any animal you own and drag it to the States List.

## Priority

The state should have a higher priority than [**Idle**](idle), [**Locomotion** ](locomotion)and [**Fall**](fall). but below [**Death**](death) since the animal can be killed any time.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F4Ef08qp2rGjLgpIRhWqZ%2Fimage.png?alt=media&#x26;token=66ef7252-6a78-44cc-a0c5-f563b832937b" alt=""><figcaption></figcaption></figure>

When the animal is on the this state, all the Lower priorities states are ignored until the[ **exit conditions**](#exit-conditions) for this state are fulfilled.&#x20;

## Requirements

### Rotator

The State **requires** an Empty Transform set as a [**Rotator**](../advanced)**.** This Rotator is the pivot of the Pitch rotation of the animal while flying.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FCjOrbyFB3TZNguAiObhp%2FRotator.gif?alt=media&#x26;token=6adf4b70-f318-41d5-87e8-bd2a22347380" alt=""><figcaption><p>The Rotator Game Object is used as the Rotation Pivot for going up and down</p></figcaption></figure>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FOA2M5rL1Yc2iAHsQuMlb%2Fimage.png?alt=media&#x26;token=a5a8fc35-25fa-439e-bd4f-a65405a613cc" alt=""><figcaption><p>All Free movement states needs the Rotator Bone set.</p></figcaption></figure>

This Rotator Gameobject will be the parent of the RootBone of the Character (First bone of the hierarchy)

{% hint style="info" %}
Its local Position and Rotation value should be (0,0,0)
{% endhint %}

{% hint style="danger" %}
### Without setting this 'Rotator' gameObject on the Advanced tab the Fly State won't work properly
{% endhint %}



### Up Down Input

To move Up and Down on the Y-Axis the Animator Requires also the Optional parameter: **UpDown.**

This input is created automatically when the asset is installed.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F6ASuR5aIQfO2mKMig1wh%2Fimage.png?alt=media&#x26;token=018cc329-b3d9-49f7-be2c-0b5a86c1394d" alt=""><figcaption></figcaption></figure>

You can create it manually by clicking on the \[Create] Button of the Malbers Input Component.

This will allow the Animal to go **Up** by pressing \[Space], or **Down** by pressing \[C].

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FczCOpbGVr4wS7jT30jmT%2Fimage.png?alt=media&#x26;token=b214aeeb-59dd-40cb-b384-f39c388e001c" alt=""><figcaption></figcaption></figure>

## Activation

This state mainly uses an Input value to be Activated.

### By Input

When Pressing the Input Value for Fly

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FkI9vbRQJbexNEfyr1B0J%2Fimage.png?alt=media&#x26;token=1f4a5f2c-3ee9-4098-a92e-680df4448a00" alt=""><figcaption></figcaption></figure>



{% hint style="info" %}
To create a quick Input for Flying use the Malbers Input context menu:
{% endhint %}

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FtPJMuzXOLaClTPrzoM9H%2FUnity_JiQHwWCrlU.gif?alt=media&#x26;token=7fdb1582-5571-40b5-b80e-5cd9eeeb760f" alt=""><figcaption></figcaption></figure>

This will be connected automatically with the state if the state has the same value for its Input.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fy7AfKFfy9lSKiYgcWyS1%2Fimage.png?alt=media&#x26;token=45ad864d-8bc0-4b0e-bf3a-dc1eaf3a1c17" alt=""><figcaption></figcaption></figure>

### Using a Zone

A Zone can activate the flying state.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FTirlQ5zajRxa59OJWC9e%2Fimage.png?alt=media&#x26;token=79941b50-0fbf-4c25-a515-37f0632db4de" alt=""><figcaption></figcaption></figure>

### Using a Reaction

Animal Reactions can be used to activate the state. Check [**Reactions**](../../reactions)

## Exit Conditions

Through code, the exit conditions will be executed to check if the State can exit. In the case of this state, the **conditions** are:

* The animal is flying near the ground so he can land (when [**Can Land** ](#can-land)is enabled)
* The Input for fly is released (when the [**Fly Input**](#fly-input) is set to **pressed**)
* The Input for fly is toggled to off (when the [**Fly Input**](#fly-input) is set to **toggle**)

## Common State Tag Properties

These are the General tag option for the Fly state:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBcTqhvVIZxfUS7YRjEBn%2Fimage.png?alt=media&#x26;token=9cd374f3-38f7-408f-9302-15e97a0830bf" alt=""><figcaption></figcaption></figure>

* **Main Tag \[Fly]**

<table data-header-hidden><thead><tr><th width="260.3333333333333"></th><th></th><th></th></tr></thead><tbody><tr><td>◻️RootMotion </td><td>☑️Sprint  </td><td>◻️Gravity  </td></tr><tr><td>◻️Grounded </td><td>◻️Custom Rotation </td><td>◻️Orient To Ground  </td></tr><tr><td>☑️Ignore Lower States </td><td>◻️Persistent = False</td><td>◻️Lock Move  </td></tr><tr><td>◻️Lock Input  </td><td>☑️+ Root Speed = True</td><td>☑️ + Pos Speed   </td></tr><tr><td>☑️ Free Movement  </td><td></td><td></td></tr></tbody></table>



### Limits

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F2vxTicpwA7eSYuvk32ho%2Fimage.png?alt=media&#x26;token=eb8b6f22-2f09-40fe-a331-67657a13198a" alt=""><figcaption></figcaption></figure>

You can set all the limits you need for your state.

The limits will block the state from Activating.

## Animator

The Fly state requires Animation States that are in charge of the Fly movement.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FaSHHKhfXRQ4XxNepQyS4%2Fimage.png?alt=media&#x26;token=e02a0884-ceed-47fd-986d-f4842adf256e" alt=""><figcaption></figcaption></figure>

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NCFjeROKc2jFcyVj1%2F-M3NDNZsj-T0GfxZ18wB%2Fimage.png?alt=media\&token=e2f41e1b-d356-4297-ab72-886516f9ee68)

All states have a core animation state. For fly is a blend tree with the Tag **Fly.**

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NILh9Jvyc1-Zqab6j%2F-M3NRfL2KT0gj4815TXG%2Fimage.png?alt=media\&token=4866cc2e-6d6f-462b-8954-c8bd63131ee0)

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NCFjeROKc2jFcyVj1%2F-M3NEUgS3AqCAZiSXYXG%2Fimage.png?alt=media\&token=d5aab9ec-a918-432e-8800-527075d5fb27)

Since the State is a moving state, the Speed Multiplier must be set as **Parameter** "**SpeedMultiplier**"

This Blend Tree is usually set this way:&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NILh9Jvyc1-Zqab6j%2F-M3NLAMFaH3vkUfiPE9u%2Fimage.png?alt=media\&token=e65dda94-1d9d-42fa-bbb4-073e3ff10ae2)

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NILh9Jvyc1-Zqab6j%2F-M3NL5rGuOg5A_iiFPqP%2Fimage.png?alt=media\&token=0ecc61b4-cd30-45b9-833c-e37554f8d578)

{% hint style="warning" %}
If you don't have all the animations, you can fill the missing states with duplicate animations
{% endhint %}

## Tag Modifiers

The Fly State has a “TakeOff”  and "Land" tag Modifier by default. This allows the fly state to have an entering and exiting animations before and after entering the core animation, which allows to modify core parameters on the Animal Controller while it is playing any of those animations.

{% hint style="info" %}
If your character does not have the **Take Off**  or **Land** Animations this can be ignored.
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3NILh9Jvyc1-Zqab6j%2F-M3NRbcOKwl0d7X7r_Vg%2Fimage.png?alt=media\&token=801a2671-5f77-4346-b14d-d7373c5da4fc)

The values for the Animal parameters that the TakeOff and Land modify are:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FMYXMVeau6o90CfW3odCR%2Fimage.png?alt=media&#x26;token=fdfb425d-8bda-423d-a67f-241a2664b825" alt=""><figcaption></figcaption></figure>

## Speed Set

The Fly needs a new [**Speed Set**](../speeds) that affects the Fly State. When creating for the first time the Speed Set will be added automatically to the Animal Controller:

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FCxGjeSvese2itGYfG69k%2Fimage.png?alt=media&#x26;token=64144514-94b7-4a58-9bf4-76fb73f61578" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
If your Fly animations are **NOT** RootMotion or they don't have the movement and turning speed you desire, then you need to **increase** the [Position ](../../speeds#position)and [Rotation ](../../speeds#rotation)values to be **greater** than zero
{% endhint %}

## Fly Parameters

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FWfajrSIfVxMk7kDg2prl%2Fimage.png?alt=media&#x26;token=0550099e-10f6-4dd3-94cc-d07a2e1225d0" alt=""><figcaption></figcaption></figure>

### Bank

Banking angle amount used while turning

![Bank = 30](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3MnarBY6UtfvetYOAG%2F-M3MoxNI0YUfvWMBUr_3%2FUgVX156gCD.gif?alt=media\&token=779a0296-0de6-4c84-bf76-f8767ee82ae2)

![Bank = 0](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M3MnarBY6UtfvetYOAG%2F-M3MpGjH3ZHQ50rhSV99%2F8WU0AAIMfa.gif?alt=media\&token=53a1740f-915b-4a77-8ef7-780bb0ce5a22)

### **Pitch Limit:**

Limit Angle to Pitch the animal while going up and Down

<img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M4-Tb1tDwrluXN0N41a%2F-M4-dGmntXs4BJejfJar%2FsssfJO7H6g.gif?alt=media&#x26;token=2fc20a25-cfee-4391-9d21-bcc045004612" alt="" data-size="original"> <img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M4-Tb1tDwrluXN0N41a%2F-M4-dmxx8vOhQgPL1O1h%2FXQ6FM35HcT.gif?alt=media&#x26;token=57c16cfb-a5fc-48e3-854c-867f682afb9f" alt="" data-size="original">&#x20;

&#x20;                        Pitch Limit = 30                          Pitch Limit = 80 (Default)

### **Bank Strafe**

Amount of banking the character can do while strafing and Flying.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FMvbexuZfEuW1z88ywdw5%2FUnity_9D0l6PedtE.gif?alt=media&#x26;token=850a949b-6de1-48b2-a37c-7b3fdb181a31" alt=""><figcaption></figcaption></figure>

### **Pitch Strafe**

Amount of Pitch Rotation the character can do while strafing and Flying.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F5NjZOzprVRZTJPPOHcvr%2FUnity_zq6XXqogzm.gif?alt=media&#x26;token=cf9e58d7-d381-4ef2-9c00-d2fcae1ae968" alt=""><figcaption></figcaption></figure>

### **Max Height**

Max Height the character can fly

### Inertia Lerp

When Entering the Fly State... The animal will keep the Velocity from the last State if this value is greater than zero

(img)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F0MLblxjB15mhL3WF0DZk%2Fimage.png?alt=media&#x26;token=f881ef20-06a6-4027-bef7-80a815f27ab1" alt=""><figcaption></figcaption></figure>

The take-off parameters will apply a force upwards to the character. This is usually used when the character does not have take-off animations.

### Take off Impulse

How much upward force will be applied

### Impulse Time

For how long the take-off impulse will be applied

### Impulse Curve

Curve value to apply to the TakeOff Impulse



<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FzOU4hFUcAe5vNQN4sLhd%2Fimage.png?alt=media&#x26;token=1b7ac018-b299-4fb4-9167-0d5edcb55179" alt=""><figcaption></figcaption></figure>

### Can Land

If the Animal is close to an object with the **Land On** Layer, it will automatically Land. (it will exit the Fly State)

### **Land On Layer**

Layer to search for Landing surfaces.&#x20;

### Land Multiplier

Ray Length multiplier to check for ground and automatically land (It uses the Chest Pivot as guide for the Land Ray)

### Inertia Lerp

When entering the Fly State... The animal will keep the velocity from the last State for a time if this value is greater than zero.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fq1OZDuGbUW5ftskkMnoi%2FUnity_z7HP1MG7Vg.gif?alt=media&#x26;token=518e25be-503f-408a-8c6d-b219d7b69e0d" alt=""><figcaption><p>Higher Lerp values will remove faster the acumulated inertia from the last state </p></figcaption></figure>

### Avoid Surface

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FnGVciRAhUf919uYwBjNV%2Fimage.png?alt=media&#x26;token=e8cfbfd4-f9cc-406d-969f-49897c935ce6" alt=""><figcaption></figcaption></figure>

If enabled, It will avoid landing on any object using a surface layer mask. This is used usually for animals that cannot land on Water.

### Surface Layer&#x20;

Layer mask to search for surfaces that the animal cannot land.&#x20;

### Surface Distance&#x20;

The minimum length, the character will be placed above that surface, to keep it from touching that surface.



<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBEGpLHmzwU9aIjSwZ4fI%2FUnity_EdEZXVb3dl.gif?alt=media&#x26;token=06055cf3-5934-4777-85cb-2a676e4f1a6c" alt=""><figcaption><p>The raven will not enter the water and it will keep a distance </p></figcaption></figure>

### Gliding

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FrdhKG0kTvIsCEneZXCNO%2Fimage.png?alt=media&#x26;token=0bd5f881-3c9b-4b4c-822f-1e665c5a76fc" alt=""><figcaption></figcaption></figure>

### Flap Speed

Which Speed in the Animation Blend tree will be used to Flap the wings

### Glide Speed

Which  Speed in the Animation Blend tree will be used to Glide with the wings

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FvLoHwTIyxrqNABrGCf46%2FUnity_WYwyRCW6mW.gif?alt=media&#x26;token=b18135db-d7d0-42fd-829d-51b227d139dd" alt=""><figcaption><p>Vertical =1 is the Flap Speed. Vertical = 2 is the  Glide Speed in the Blend Tree</p></figcaption></figure>

### Glide Only

The character will activate only the glide animations and it cannot go upwards

### Glide Only Idle S

When the Forward Input is Released, this will be the movement speed the gliding will have

### Glide Only Idle V

When the Forward Input is Pressed, this will be the movement speed the gliding will have

### Auto Glide

If Enabled the animal will change from flapping to gliding automatically&#x20;

### Glide Chance

Time range the animal will glide when Auto Glide is true

### Flap Chance

Time range the animal will flap the wings when Auto Glide is true

### Variation

Variation to make Random Flap and Glide Animation





### Down Acceleration

Gravity Force applied to the Fly State.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F2hw6RbZz7Vikfx83yKbm%2Fimage.png?alt=media&#x26;token=13db72f9-f17c-46d1-8948-43ec7f625327" alt=""><figcaption></figcaption></figure>

### Gravity Drag

If the value is greater than zero the character will go down gradually while flying.

### Down Acceleration

If the character plunges down toward the ground it will gain speed depending on the value of this parameter.



### Bone Block Landing

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FSVmv5smffxhAkdBliw6d%2Fimage.png?alt=media&#x26;token=09593926-99ed-4493-9df1-adf06ee760d7" alt=""><figcaption></figcaption></figure>

Sometimes when the animal is very large and has a large head the landing may be blocked by the head and it cannot properly land. that is why, when **Can Land** is active, a second ray is cast from another bone (Head) to see if we can find ground to land.

### Bone Name

Name of the Bone. By default is "Head"

### Bone Offset Position

Local Offset position from the bone position

### Block Land Distance

Ray Distance for finding the ground from the Bone

###

