Trouble using GetForwardVector and GetRightVector to make AI Strafe

I’m trying to use GetForwardVector and GetRightVector of my AI Actor to get them to strafe left and right as well as backwards but they always end up moving towards the origin point. Here are some screenshots of my scripting:

Strafing to the right:

Strafing to the left (same thing but GetRightVector is multiplied for -1.0 for what I assumed reverses direction).

What am I missing here?

Thanks!

Bump! Still trying to work out the math

any progress? Really looking to figure out AI Strafing

I don’t understand what you’re doing. if you want to have the pawn move to the pawn’s right based on the direction it is facing, why all this fancy GetRotationFromX and Location and whatnot? Why not just do the following:

  1. Get the Pawn’s Right Vector, multiply it by the distance you want to strafe,say, 3000 (=30 meters).
  2. add this amount to the pawn’s current location.
  3. use that resulting sum as the new destination location for the Move.

I don’t know if this will work but it makes sense to me. On the other hand, I don’t understand how the math works in your screenshot. Maybe you can explain it to me step by step though.

This video here has the strafing blueprint and has a pretty good explanation behind it. It’s what I’m basing my strafing BP on and works perfectly.

OK thanks I’ll check it out

Thank you. I watched the video and it looks very different from your screenshots. I recommend you watch the video again and try to make your Blueprint match it more closely. It looks like he’s using a very similar approach to what I suggested in my comment earlier.