Third Person C++ MovementInput Problem

Good morning guys,

I’ve been experimenting with the TPP C++ base code, and one of the things I noticed is that if you add MovementInput using any vector (even GetActorRightVector()), instead of just moving in that vector, it seems to move and rotate around it, which makes no sense, I just want to make (in some occasions) my character move to the sides, not to make him rotate lol.

Is anyone else experiencing this / found a solution?

On a side note, can someone clarify the meaning of the “Transient” property? (

Thank you for your reply Steve.

Well, would there be an equivalent in C++? (Or can I just call Move To via UKismetSomething in the code?)

Ahm Steve from Epic you gave me an answer and deleted it… can you at least explain why? Didn’t it work properly? Cus it kinda made sense when I read it lol

Hi GuilhermeB,

If you want your character to strafe side to side instead of turning and facing that direction, you can actually make a slight change in the code where you are configuring your character movement. The Third Person Template uses the following line of code:

CharacterMovement->bOrientRotationToMovement = true; // Character moves in the direction of input...

Replace this line with:

CharacterMovement->bUseControllerDesiredRotation = true;

This will make sure the character is always facing the same direction as the camera, and will strafe from side to side without turning in the direction it is moving. Of course, the downside to this is that the character will always turn to face the same direction as the camera. It should get you started towards what you are looking for, though. I would recommend looking through CharacterMovementComponent.h to get more details about how you can alter your character’s movement.

Sorry GuilhermeB… I was discussing this with Tim and he pointed out that the link I sent you was for a Behavior Tree for an AI Character instead of a player character, so I thought I’d remove my post so as not to confuse other viewers. Tim’s answer is more relevant to your question. Hopefully the information that he’s provided has resolved your issue. If not, let us know.


Works like a charm! Thank you both!

And sorry if it sounded rude Steve Hardister, wasn’t meant to.

Again thank you both

Actually, if I may, just a small question:

  • By default (and I want it this way) the mouse changes the rotation of the character and he moves in that direction,great. But what if, under circumstances I wish to make it so that the mouse movement can change the camera’s direction, but not the player’s rotation? And what if I want to stop both? Which bool controls it?

Thanks in advance, hope I’m not breaking any rule by asking another question

Anyone? :confused:

Sorry for the delay in getting back to you. The original bool, ‘bOrientRotationToMovement’, provided the freedom to move the camera around without changing the direction the character was facing. In this case the facing of the character is based on the direction it is moving, which wasn’t quite what you were looking for. The bool that I suggested using instead ties the facing of the character to the direction the camera is looking, which gives you the ability to perform strafe movement. They are essentially opposites:

  1. Independent camera movement, character facing tied to direction of movement.
  2. Independent movement, character facing tied to camera.

In both cases, movement direction is related to where the camera is looking. If ‘bUseControllerDesiredRotation’ gives you the majority of what you are looking for, I would go ahead and just use that. For those times when you want to be able to rotate the camera without changing the character’s facing, it depends on what your character is able to do at the same time. If this will only happen when the character is not moving, you can use the following line to disable the character’s rotation when turning the camera:

CharacterMovement->RotationRate = FRotator(0.0f, 0.0f, 0.0f);

Just make sure to reset RotationRate when the character moves again (or once you no longer want to be able to rotate the camera independently of the character’s facing):

CharacterMovement->RotationRate = FRotator(0.0f, 540.0f, 0.0f);

Alternatively you can alternate which bool value is true (keep in mind that if both are true, then bOrientRotationToMovement takes precedence). This might be the simplest option if you will want to be able to rotate the camera independently of the character’s facing while the character is moving. It will probably take some tweaking and experimentation to find out what works best for your needs.

Thanks Tim!
Now I feel dumb, this is pretty straightforward, should have remembered that, again thank you!