Hello all,
I have been using UE 4.17 and following unreal’s tutorial on implementing player movement. Since though this tutorial is based on UE 4.15 I am having some issues on finding the correct objects to get control rotation.
On the tutorial the code used is the one below:
void AFPSCharacter::MoveForward(float Value) { // Find out which way is "forward" and record that the player wants to move that way. FVector Direction = FRotationMatrix(Controller->GetControlRotation()).GetScaledAxis(EAxis::X); AddMovementInput(Direction, Value); }
But when I tried to implement it, the linter couldn’t find Controller variable (I assume this was taken from Character.h on 4.15). I have searched for quite some time and found that in order to get control rotation that is needed in the above code I need to have a Controller object initialized, but I couldn’t find a way to get the controller. One way I found was to use GetController from APawn class but then again I cannot get APawn from somewhere else than an AController object…
I hope I didn’t confuse you and I hope you can help me.
Thank you very much,
AC