How to get local velocity?

I am using a 2D blendspace to make my character idle, walk, run, strafe left, strafe right. I can make him Run just fine, but I cannot make him strafe properly. My layout is LeftStick controls location, right stick control rotation. So I have to get the right vector based on the characters local velocity.

Here is what I have now. I removed the parts that weren’t working. And am setting the StrafeSpeed variable.

Remember the right stick controls the rotation of the character. So the characters velocity can be the same, while the character is rotating, but I have to be able to strafe when it is realistic.

Please help, and thanks you.

Its going to be a little more complicated than what you have there. What that bit of blueprint you have does is take the characters velocity, and takes that velocity and finds out how big it is.
Its good for getting speed, but doesn’t give you any direction info.

Your probably going to want to compare the forward vector of your character to your character’s velocity to find out what direction they are moving (relative to what they are facing.)
Its late and my logic is fuzzy, so I can’t do much more than point you (in hopefully) the right direction.

I will try, if you can attempt doing a blueprint for me or at least terminology that would be amazing. And I know what the blueprint I posted does. I was showing that I need to set the Strafe variable.

Try playing with this:
Not exact, and I am very terrible with math, but it sort of seems to do what I had hoped it would.

There should be an example of a strafing 3rd person pawn in the Content Examples project too, which might help. If you search for the Animation Blueprint called “HeroTPP_AnimBP” and look in the event graph, you can see where it’s setting a direction variable for the Blendspace using the “Delta rotator” node. With that setup you shouldn’t need a strafe speed variable for the Blendspace, just one for overall speed and one for movement direction to blend between the different running animations.

Their isn’t one.

Sorry, I guess the Content Example map that uses that anim Blueprint must not be released yet. In that case, do you have the “Animation” content example map? If so, example 1.10 in that map is a playable 3rd person character pawn who can strafe, so that should be helpful for reference.

The relevant Animation Blueprint to search for in that case is called “Owen_ExampleBP”, and while it’s a little more complex because of the aim offset stuff in there, the part of the event graph labelled “Locomotion Direction” is the important bit. The movement direction and actor rotation are being used to calculate a direction variable that ranges from -180 to 180. That variable along with the speed variable is being fed into the 2D Blendspace (Owen_Locomotion_Blendspace), which blends between 4 different running animations for each direction.

I found it thanks a bunch. I will try to replicate this and get this going. I will post back with results.

Thank you everyone.

I’ve tried ten separate times trying to get my character to do what Owen is doing in Owen_ExampleBP. Thing is, when i complete everything with my mesh/skeleton and anims I get everything hooked up EXACTLY like Owen_ExampleBP, it doesn’t work. Sure idle state works but locomotion state doesn’t. Everything moves like it should (character doesn’t rotate when you press a d or s) except that it never goes from idle to actually playing the locomotion blend-space… also aimoffsets dont update char’s look pos…

I’ve even went through owen’s entire setup against mine, twice just now and there is not one single thing different at all that i can find.

There HAS to be something extra that owen is doing.

Epic you guys should really do a blog post or video tutorial about strafing and aimoffsets together. getting told to look at an example is great for simple things but advanced setups like these are really not that great.

I can set them up individually but together it seems I just have no idea.

I’ve just given up and i don’t really care about strafing with aimoffsets anymore…

I tried one more time by migrating the 3rdpersonpawnbp to my project, changed the skeleton to mine left the anim blueprint to none in the characterbp , then i re-targeted the owen anim blueprint to my skeleton and changed out the references with the animations/aimoffets in the anim blueprint’s statemachine and changed the anim blueprint in the 3rdpersonpawnbp to the re-targeted one and it now works… and i still can’t find a difference between my original tries and the re-targeted animbp