I can use
GetMesh()->SetRelativeRotation() to force my character to look in a direction without moving, but it doesn’t quite work (behavior changes when movement is being applied as well!).
Is there an idiomatic method of setting a character look direction regardless of move direction?
I’d like for my character to be able to walk in a direction (strafing) while still looking in another direction, such as in Gauntlet or Helldivers.
If there isn’t an idiomatic method, what will work?
This is what I have now in
const auto LookDirection = FVector(GetInputAxisValue("LookForward"),
if(LookDirection.SizeSquared() > 0.2f)
You should move your character in world coordinates and rotate it using a controller rotation. Then it will waor exactly as you want. Please, refer to this video to see an example(it is in bp, but this is exactly how it is done in c++ too): https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gb5sdygbSiEU7hb0eomNLdq/cgY1D9GwEYk/index.html
i tried to convert the tutorial blueprint to c++ but this doesn’t seem to affect the character’s rotation!
that’s a little odd since it seems to run contrary to the results people are discussing on forums.
is it possible something else is wrong with my character setup?
const auto LookDirection = FVector::FVector(GetInputAxisValue("LookForward"), GetInputAxisValue("LookRight"), 0.0f);
if (LookDirection.SizeSquared() > 0.1f)
UE_LOG(LogTemp, Warning, TEXT("Setting rotation to %s"), *LookDirection.Rotation().ToString());
i’ve opened a slightly more specific question for the situation: https://answers.unrealengine.com/questions/433383/player-controller-rotation-not-changing-character.html
if we can solve it here too that would be great