Hello, I have my character moving with WASD keys, and also LineTracing beneath cursor to face character towards mouse. Now I’d like my character to ALWAYS face cursor, but also move independently, so if I’m facing forward and hit ‘A’ key I want it to go left, no matter which world direction the character is currently facing. There is something to do with Vectors I just can’t figure out what. Can you please help?
So with the new Enhanced Input I have seperately W, A, S, D (left, right, up, backwards) and instead of plugging ‘Action’, I plug in ForwardVector, which works for forward and backwards, (since backwards is just ForwardVector negated) but doesn’t work for sideways movement. Basically I want my char to strafe left and right whilst facing the cursor. Just please show me a blueprint of either left or right movement.
I have this in place for LineTracing mouse :
And this to move forward (backwards is the same just negated) :
Please help!
hi,
do you mean something like this ?
the next two pictures are one node… was too long for a single image
and here the input
hope this helps you 
cheers 
p.s. had no strafing animation 
1 Like
Hello!
This is exactly what I need.
Could you just post a picture of your enhanced input? I mean the context?
I’m not sure to use swizzle axis or scalar or whatever else…
The character moves ok forward and backward, but goes into circle when strafing.
Also here where you have vector multiplied by -1, I just have negate vector, thats the same right? Because I can’t get to multiply by float.
And it also appears that in one direction he strafes correct, the other he goes circular towards cursor.
Thanks 
1 Like
hi,
sure i will make you the screenshots in an hour or so then i should be back at my seat 
the input is straight from the third person template
cheers 
p.s. the character will strafe around the cursor position in a circle, if you dont want that there are some changes needed, because as soon as you strafe and the player should always face the mouse cursor it has to go in circles 
i would have the idea if you do not want that in case of strafe player is not allowed to face cursor and when strafing ends it will lerp to face the cursor position
i think you can leave that -1 multiplier for the vector
i thought in case of player position is negative and cursor position is negative ill add it negated but if it adds up the length should also work… this is just so it dont freaks out if your cursor is over the player
i will revisit it very soon, later
Ok, thanks.
The idea is like those isometric shooters you know, that spawn millions of mobs.
Then you can aim any way you like but you still strafe in a straight manner, not around the cursor. Though as your video shows, doesn’t it run straight up and down? I need the same action sideways.
Thanks again 
1 Like
ok i am back ^^
one second i have something for you 
Did you forget to post or are you having trouble too?
creating post, this is the new one 
no just making images 
will be up in a few minutes
ok otw ^^
1 Like
ok here we go 
character setup
variables and input first
this will be the for the initialization
here is the main function in event graph but you can pack this up
the only thing you want to set is…
MaxStrafeAngle → defines when a new strafe axis will be choosen… its a dot but for ease of use you plug in a angle in degree (45 in demo video)
StrafeLerpSpeed → defines how fast it will snap (5 in demo video; forgot to make it public)
here are all functions
and here are all macros 
and this should be the result
if something is missing please let me know 
i hope this helps you 
here is the uasset file of the bp… input needs to be setup or changed
BP_ThirdPersonCharacterMouseFace.rar (54.0 KB)
cheers 
2 Likes
Really appreciate the effort btw 
For now, W and D keys work the same as S and A…
Also debug lines are not drawing. I guess I missed something trying to find out what.
2 Likes
did you plug in the beginplay part, i missed that one in first post
you can change the input, ad -1 - 1 and sw -1 - 1 instead of x y
maybe these need to be set
disable yaw rotation
i will make a new bp later with only that code in it… atm it depends on input my widget, interface for other usage
then ill link the uasset file in a rar to the post
Hey that would be cool
Yes I Tried the BeginPlay…
Not even Debug is being drawn. Zip file would be great 
Though, SmoothStrafeVector isn’t being called anywhere. As far as I can see.
its in the smooth strafe vector function
download link is in the movement post at the end 
Thanks for the effort man. Much appreciated 
1 Like
Thanks for your effort, how can we do that with strafe animation? for example if we are looking top and moving right, it needs to strafe right anim. But if we are looking right and moving up, it needs to strafe anim left.