Always happy to see people sharing and I’m even happier to see other peoples approaches on creating a TFP viewpoint!
That said, I have a few points and some suggestions if you will bear with me.
1 Frame Lag
If you’re experiencing a 1-frame delay in the rotation, I am not sure how it is caused by the tick order you mentioned.
You see, pawn controlled by the player controller already has its rotation updated by APlayerController::UpdateRotation() before its ticks.
void APlayerController::UpdateRotation( float DeltaTime )
// Calculate Delta to be applied on ViewRotation
APawn* const P = GetPawnOrSpectator();
This is done by before APlayerController::Tick() is even called:
Thus your call to PreUpdateCamera() at the end of APlayerController::Tick() is redundant.
It may simply be something unique to your setup.
For instance, if you have bUseControllerRotationYaw set to false on your character, FaceRotation() won’t do anything.
You can get the local rotation for use in the animation blueprint more easily by using the method provided by the ShooterExample project:
FRotator AShooterCharacter::GetAimOffsets() const
const FVector AimDirWS = GetBaseAimRotation().Vector();
const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS);
const FRotator AimRotLS = AimDirLS.Rotation();
Or even something like:
(GetBaseAimRotation() - GetActorRotation()).GetNormalized();
I recommend using an animation curve fed into the alpha value of your aim offset node instead.
In this way you can easily blend the aim offset in/out depending on the montage without relying on a hard coded fix.
Animation tip to avoid motion sickness
Great advice, though another method to reduce the issue is to use the controller rotation at all times.
This will mean using a different approach when you want the animation to affect the rotation of the camera, but otherwise works quite nicely.
Thanks again for sharing!