Links
🕺

Strafing

🚧Under Construction

Overview

Strafing is the act of moving sideways in a video game, either in relation to a target or the game's camera. Strafing allows a player to keep the camera focused on a target such as an enemy, while moving in a different direction.
Strafing requires new set of strafing animations on your Animator Controller. Make sure you have them set correctly
You can use Strafing for Locomotion, Fly, Swim, Swim underwater, and all the States that requires the animal to move.

Requirements

Can Strafe Parameter

To activate strafing, enable CanStrafe on your Animal Component, on the General Tab.

States <Can Strafe>

The States also need the Strafe activation, since you can have strafing on the ground but not while Jumping or Swimming.

Aim Component

Strafing Requires the Aim component.
  • Set the proper Animations on your Animator with the correct enter and exit transitions.

Animator

Parameters

All strafe animations for the Animal Controller requires 4 Animator Parameters.
Horizontal, Vertical, StrafeAngle and Strafe
These parameters will be updated by the Animal Controller.
This values will be updated by the Animal Controller and it will handle all Strafing movement inside the Animator

Movement

Here's how the Movement Strafing Blendtree for the State looks like.
Blend Tree for Locomotion. Same applies to Fly, Swim
Each movement has 8 Direction Blendtrees animations:
These animations will be added with Horizontal and vertical Values of 1, properly distributed.
Animation
Vertical
Horizontal
Walk East
0
1
Walk West
0
-1
Walk North
1
0
Walk South
-1
0
Walk North East
1
1
Walk North West
1
-1
Walk South East
-1
1
Walk South West
-1
-1
Inside each Direction Blendtree are the speeds for each direction the animal may have:
1D Blend Tree for North Direction Using the [Vertical] parameter
1D Blend Tree for East Direction Using the [Horizontal] parameter
For the Idle blend Tree we use the Strafe Angle Parameter. to rotate towards the Target in place:
1D Blend Tree for East Direction Using the [StrafeAngle] parameter
If the Locomotion strafing has more speeds; those animations will be added on this blend Tree .

Enter Transitions

For each state that has Strafing you will need to add Enter transitions for each default animations.
E.g. For Idle. the Transitions conditions to the Idle Strafe should be Strafe = true; and it should be the first transition to check:
That way it will always check first if the animal is strafing. If not then it will do the default Idle Animations
Same goes to all the other states.

Exit Transitions