Move Character with WASD, and rotate towards mouse cursor(like isometric shooter)

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 :slight_smile:

cheers :vulcan_salute:

p.s. had no strafing animation :frowning:

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 :slight_smile:

1 Like

hi,
sure i will make you the screenshots in an hour or so then i should be back at my seat :slight_smile:

the input is straight from the third person template

cheers :vulcan_salute:

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 :slight_smile:

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 :slight_smile: 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 :slight_smile:

1 Like

ok i am back ^^

one second i have something for you :slight_smile:

Did you forget to post or are you having trouble too?

creating post, this is the new one :slight_smile:

no just making images :smiley:
will be up in a few minutes

ok otw ^^

1 Like

That is what i want :slight_smile:

NIce thanks :slight_smile:

1 Like

ok here we go :slight_smile:

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 :slight_smile:



and this should be the result

if something is missing please let me know :smiley:

i hope this helps you :slight_smile:

here is the uasset file of the bp… input needs to be setup or changed
BP_ThirdPersonCharacterMouseFace.rar (54.0 KB)

cheers :vulcan_salute:

2 Likes

Really appreciate the effort btw :slight_smile:

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.

1 Like

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 :smiley: then ill link the uasset file in a rar to the post

Hey that would be cool :smiley: Yes I Tried the BeginPlay…

Not even Debug is being drawn. Zip file would be great :smiley:

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 :slight_smile:

Thanks for the effort man. Much appreciated :slight_smile:

1 Like

no problem :slight_smile: