Walking Animation Blendspace directions

Hey there!

I’m adding new motioncapture animations to my fighting game project. I’ve run into an issue with my walk blendspace animations.

The Issue:

My game uses a shared camera with each actor looking at each other. The second players animations are not activating correctly. For example when moving backwards, its playing the forward animations. The first players animation seem to be activating correctly, but they could use some work.

What I have so far:

  1. 4 Different blendspaces foreach direction, all of which have 3 main animations For example: Forward, forward right, forward left.
  2. Basic Directional calculations that uses the “calculate direction” node and getting the actors “inversed transfrom direction”

What would be the best way to implement the blendspaces so that regardless of where the character mesh is facing it will always fire the correct animations? Should I be using Input axis values to determine which animation to fire?

Thanks in advance,
SamuelB

  1. You should only need one blendspace.

  2. In my experience, using the speed/direction method ends up working better for all situations. I have a setup where you can free-run (camera not locked behind character) as long as you aren’t aiming. When aiming the camera locks and you strafe. The only way I could do that with one BS was with direction/speed.

  3. You want to use the actor rotation to figure out which way is forward and which way is right. There are lots of resources explaining how that works. It involves getting a “forward vector” from the actor rotation and then multiplying the forward axis by that to get the relative forward motion. Same with the “right vector” from the actor rotation.

Try to get somewhere and if you’re still stuck, let us know.

Hey again Jin_Ve!

Thanks for the quick reply!
Its been sometime since i did blendspaces. The resources that are available are somewhat helpful, but the situation is abit different from my setup. I’ll try using one blendspace for each stance, this would probably require me to redo my state machine. Do you see something wrong with my state machine setup?

So I’m guessing i can just set a single state from the entry point, which would hold my new blendspace containing each directional animations.

-SamuelB

Oh, stances? Yeah, you want different blendspaces for different stances. I don’t think there’s a 3D blendspace. I thought you meant you were somehow using different ones for different orientations.

But what you’re showing there seems weird. Are you using a 1D or 2D BS? Are you going for left/right/fwd/back motions only (no forward-left on an angle and such)?

Generally, you would use a single 2D blendspace for each stance (walking, crouched, in-cover, etc) and you only need one state in the AnimGraph to handle that. You’d have to explain why you’re separating out the left/right/back motions.

(Edit: Technically, in-cover would probably be a 1D BS cuz you only need to go left/right)

My setup is pretty old, like a year old or something. I think it was setup like this before i was using blend spaces., so that i would activate each animation with booleans. I guess i just have to make a blend space for each stance( there are 4 different stances). I’ll report back asap when i’ve tried it
out. Thanks again Jin_ve!

Seems like i didn’t answer the question: “Are you going for left/right/fwd/back motions only (no forward-left on an angle and such)?”. So I have 8 different directions for each stance F,B,R,L,FL,FR,BR,BL. Should I stick them all into one blendspace or create 2 for backward and forward directions? I’m using a 2D Blend Space.

EDIT: I just realized i major flaw in my movement mechanics. My characters are looking at each other, so the input axis are of course reversed on the second player. So whenever the 2nd player is trying to activate a forward animation, it activates a backward animation. This is due to that i was previously using a camera component attached to each actor. With the new shared camera i’m using, i’ll have to recalculate the direction so that each the input values are always the same relative to the players rotation.

I’m attempting to use the same vector calculations you helped me with on the bot animation inputs. So far it seems to be giving correct values for each player. So whenever one of the players is moving back the forward value will always be -1 for each player. I’m going to use these values to set the animation booleans, this should fix the animation issue i think.

OK, I was able to fix the Directional issue by using similar calculation supplied by Jin_Ve in this post: https://answers.unrealengine.com/questions/738222/ai-check-which-direction-bot-is-moving.html

I created a function that calculates the correct direction of the players. For example, if a player is moving Backwards relative to the enemy player. the forward value will be between 0 and -1 etc. As for the blendspaces, I’ll make another question if needed to keep this thread as short as possible and not getting side tracked too far.

Thanks again Jin_ve for your input!

-SamuelB

Sounds right. You want to make the characters work as if there was no camera. They should be moving relative to themselves. Then you can rotate them any way you want (like relative to a camera) and they will always play the right animation.

You want a single blendspace with all the animations for that stance. There are tons of tutorials going through it.

Ok cool, i’ll look into that blendspace stuff later! thanks