🦅Fly
1.4.2d
Last updated
1.4.2d
Last updated
The Fly State allows the animal to fly and glide. Its State ID is 6.
To create a new Fly State Click the Plus button on the States list
Or just duplicate any of the already created Fly States Assets of any animal you own and drag it to the States List.
The state should have a higher priority than Idle, Locomotion and Fall. but below Death since the animal can be killed any time.
When the animal is on the this state, all the Lower priorities states are ignored until the exit conditions for this state are fulfilled.
The State requires an Empty Transform set as a Rotator. This Rotator is the pivot of the Pitch rotation of the animal while flying.
This Rotator Gameobject will be the parent of the RootBone of the Character (First bone of the hierarchy)
Its local Position and Rotation value should be (0,0,0)
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.
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].
This state mainly uses an Input value to be Activated.
When Pressing the Input Value for Fly
To create a quick Input for Flying use the Malbers Input context menu:
This will be connected automatically with the state if the state has the same value for its Input.
A Zone can activate the flying state.
Animal Reactions can be used to activate the state. Check Reactions
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 is enabled)
The Input for fly is released (when the Fly Input is set to pressed)
The Input for fly is toggled to off (when the Fly Input is set to toggle)
These are the General tag option for the Fly state:
Main Tag [Fly]
You can set all the limits you need for your state.
The limits will block the state from Activating.
The Fly state requires Animation States that are in charge of the Fly movement.
All states have a core animation state. For fly is a blend tree with the Tag Fly.
Since the State is a moving state, the Speed Multiplier must be set as Parameter "SpeedMultiplier"
This Blend Tree is usually set this way:
If you don't have all the animations, you can fill the missing states with duplicate animations
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.
If your character does not have the Take Off or Land Animations this can be ignored.
The values for the Animal parameters that the TakeOff and Land modify are:
The Fly needs a new Speed Set that affects the Fly State. When creating for the first time the Speed Set will be added automatically to the Animal Controller:
Banking angle amount used while turning
Limit Angle to Pitch the animal while going up and Down
Pitch Limit = 30 Pitch Limit = 80 (Default)
Amount of banking the character can do while strafing and Flying.
Amount of Pitch Rotation the character can do while strafing and Flying.
Max Height the character can fly
When Entering the Fly State... The animal will keep the Velocity from the last State if this value is greater than zero
(img)
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.
How much upward force will be applied
For how long the take-off impulse will be applied
Curve value to apply to the TakeOff Impulse
If the Animal is close to an object with the Land On Layer, it will automatically Land. (it will exit the Fly State)
Layer to search for Landing surfaces.
Ray Length multiplier to check for ground and automatically land (It uses the Chest Pivot as guide for the Land Ray)
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.
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.
Layer mask to search for surfaces that the animal cannot land.
The minimum length, the character will be placed above that surface, to keep it from touching that surface.
Which Speed in the Animation Blend tree will be used to Flap the wings
Which Speed in the Animation Blend tree will be used to Glide with the wings
The character will activate only the glide animations and it cannot go upwards
When the Forward Input is Released, this will be the movement speed the gliding will have
When the Forward Input is Pressed, this will be the movement speed the gliding will have
If Enabled the animal will change from flapping to gliding automatically
Time range the animal will glide when Auto Glide is true
Time range the animal will flap the wings when Auto Glide is true
Variation to make Random Flap and Glide Animation
Gravity Force applied to the Fly State.
If the value is greater than zero the character will go down gradually while flying.
If the character plunges down toward the ground it will gain speed depending on the value of this parameter.
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.
Name of the Bone. By default is "Head"
Local Offset position from the bone position
Ray Distance for finding the ground from the Bone
◻️RootMotion
☑️Sprint
◻️Gravity
◻️Grounded
◻️Custom Rotation
◻️Orient To Ground
☑️Ignore Lower States
◻️Persistent = False
◻️Lock Move
◻️Lock Input
☑️+ Root Speed = True
☑️ + Pos Speed
☑️ Free Movement