Top Down Strafe to Mouse Location

Hello All

I’m brand new to UE4, and reading up on tutorials and the likes to help myself learn the blueprint system.

What I am trying to achieve is a top down WASD movement system, but with the mouse used as an aiming point.

So far I’ve got the rotation sorted out, it points to where the mouse is, and W & S goes forward and back to where the mouse is pointing on the screen.

The problem I’m having now is with strafing.

I can get it to strafe on the Y axis with no problem… but say if the character is moving forward on the Y axis, and I press “A” to strafe left… he will just continue going in that direction.

So ultimately I need help with strafing, so that the character will move side to side based on where the location of the mouse is on the screen.

Here is what I have so far (sorry for the mess, really I’m new to this).

Appreciate the help!

You have to set a proper value for “World Direction” on the RightMovement. This gonna be the vector you are using for the forward input, just rotated 90 degrees to the right.

Thank you for the answer.
Do you have an example in blueprint that I can refer to?

Thanks

Does this help?

Thanks, I got a bit further, but just can’t seem to get the angles right.

I tried placing the current mouse location as the vector, and added +90 on Y in axis, but it was a bit strange. Tried also feeding off the forward movement into the vector on this node, and adjusted the Y axis, but it just keeps going forwards and backwards, instead of side to side.

If you have a valid forward vector then getting the right/strafe vector is pretty simple. Try just using a “Rotate Vector” node based on your forward vector.

81279-capture.png

I know it’s been a while since this was written, but wanted to say thanks, as this pretty much did the trick!