🕺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.
Strafe Animations
This will update the animator to change animations while strafing. If you do not have animations you can still use straffing with the default animations but it would look strange for grounded animations.
Stances [Can Strafe]
Also if you have the animations for the Stances you will need to activate it there too:
E.g. Steve can strafe while Crouched and on the Default Stance:
Speed Modifiers
For Inplace animations increase the Strafe Value on the speed modifiers to make the animal move in all eight directions. Change the Strafe and Strafe [L]erp values to have the desired movement.
Aim Component
Strafing Requires the Aim component. This will send the correct direction to Strafe to the Animal and the Animator. Using the Camera Direction or a Direction to a Target
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, AimHorizontal (from the Aim Component) and Strafe
These values will be updated by the Animal Controller and the Aim component and it will handle all Strafing movement inside the Animator
Movement
Here's what the Movement Strafing Blendtree for the State looks like.
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:
Diagonal Directions has a 2D Freeform Cartesian BlendTree.
Check Steve (Human) Animator for more details.
For the Idle BlendTree, we use the AimHorizontal (former StrafeAngle) Parameter. to rotate toward the Target in place:
Enter Transitions
For each state that has Strafing, Add an [Enter transition] 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
Do the same for all the States where Strafing is enabled.
Last updated