How to set character movement with top-down view?

Hello. I’m trying to set up character’s movement using top-down template. How can I do it? I’ve tried the usual script:


But the action value X is always 1.0 and character is moving only to the right side and not rotating even when I’m using W, A, or S. How can I fix this?

Hey @Texn0krat!

Can you show your Input Actions necessary and the IA Context? Things here look fine.

Get that back to us! :slight_smile:

Hello, @Mind-Brain ! Here’s my input actions:


and IMC:

Or IA context is something different?

one thing is to use GetActorRotation not ControlRotation since Control is the camera and the camera is no top-down

Like this?


I don’t see any difference - character still can’t move anywhere except right direction.

One thing I can see, go ahead and do this then try it out:

On the IMC, “S” and “A” need a Modifier called “Negate”!

That’s how it goes opposite of “W” and “D” to get negative values.

Do that and let us know what changes and what’s still wrong! :slight_smile:

Tried it. Rigth-left direction is working now, but W is moving character to the right and S - to the left… Maybe, I do something wrong with forward vector?

OH! The swizzle! It converts the axis to Y inputs. That needs to go on W and S!

So W will just have the Swizzle and S will have both Negate and Swizzle!

2 Likes

Thank you very much! It works! The last thing I need to know - how to make it rotate? For now character is just looking forward.

I mean that’s really not related, though I know it seems like it would be.

The way you rotate the character really depends on how you want the game to play.

Try searching for “Orient rotation to movement”, it’s just a checkbox, see if that’s what you’re needing!

Unfortunately it works strange - character is getting a “tank” movement like in resident evil, where you setting the direction with A, D and moving with W, S. I’ve disabled Use Controller Rotation Yaw and enabled Use Pawn Control Rotation.
movement

Wait so is the video with Orient Rotation to movement?

Or is that with Use Controller Rotation Yaw and Use Pawn Control Rotation?

If this game is going to have fixed camera you need to use world values for your directional inputs instead of character-rotation based ones. :slight_smile:

Yes

No and yes
So,
Orient Rotation to movement - enabled
Use Controller Rotation Yaw - disabled
Use Pawn Control Rotation - enabled

In that case, should I fix this:


replacing “get controlled pawn” node with something different?

You would just replace the “Get Right Vector” and “Get Forward Vector” that you’re getting from your actor with just “Vector Forward” and “Vector Right” (because you want world, not actor).

These should return 1,0,0 and 0,1,0. If W and S go left to right and A and D go forward and back, switch them (it depends on if X or Y is forward in your built level.)

1 Like

Works like a charm:


Thank you very much for your help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.