Hello.
I’m at the stage of my project where I need to improve the character animator to add missing locomotive animations, and I am confusing myself with the various tutorials. I’ve been fnding a lot of tutorials that show how to use a blend tree to change animations with speed (move from walk to run and back) or play animation variations for direction (turning slightly to the right or left). But my character’s ‘turn’ animations are not looped. When my character is sprinting and he needs to make a 180deg change of direction, he needs to run the ‘plant and turn 180’ animation, then pick up running in the new direction. I’ve not found any tutorials that are helping with that.
I’ll explain a bit of the setup, then get to my question…
My animator currently has the following setup.
The ‘Locomotion’ state is a blend tree (that has other blendtrees). The Getups and Backpedal are unimportant for this discussion.
Locomotion is a blendtree that handles all the base movment, idle, walk, jog, run, sprint. A Speed variable is used to transition between these. Each of these blendtrees is made up of other blendtrees that manage directional changes. My directions are in degrees. So I have a Sprint Forward, Cut45, Cut90, Cut135, and Cut180 (for both left and right). These are not looped, once the character makes his 45deg cut, he should be pointed in (more or less) the right direction and just pick up sprinting. The small adjustments to get him exactly in the right direction shouldn’t invoke an animation change.
The sprint portion is below.
Anyway, now I’m finally getting to my question.
The character is given a waypoint in the world and a speed to get there.
- What’s the best way to determine the angle required to turn?
- How do I stop the animator from looping the cut animations. For example, if the determined angle is 180 degrees, the animator just loops that animation over and over again. When I try to adjust this in script, the angle towards the target lowers (because the character is turning as part of the animation) and the animator wants to kick into the other cut animations. For example, as the angle reduces from 180, the animator then wants to play the Cut135, then the Cut90, etc… it shouldn’t actually do that, it should play the 180 until the character is turned around, then it should just revert to sprint until he needs another hard cut.
Am I going about this the wrong way? Hopefully what I’m asking makes sense.