My first person shooter character’s hand appears to be behind by a frame in some cases
I ran into a very difficult to debug issue and it seems like this is the order of how things happen during a game tick.
ACharacter Tick
APlayerController Tick
ACharacter FaceRotation
APlayerCameraManagerTick
ACharacter CalcCamera
Render Frame??
Some other things happen
AnimBlueprints update
Next Game Tick
So I noticed that if my character’s first person camera component Relative Transform is updated before CalcCamera is called during a tick, my character’s hand is off by a frame. This is visible when my character is crouching and the animation plays smoothly. This leads me to beleive that a frame is rendered some time in the middle of a game tick but the anim blueprints are evaluated next frame before the next game tick. The anim blueprint is where the character’s hands are positioned relative to the eyes via IK.
If I add some safe guards that prevent the camera component from updating during a game tick until after CalcCamera is called, I no longer see any lag of hands being off by a frame during the transition between a character standing and crouching, and vice versa.
Tick
DON’T UPDATE CAMERA COMPONENT TRANSFORM
========================
ACharacter Tick
APlayerController Tick
ACharacter FaceRotation
APlayerCameraManagerTick
ACharacter CalcCamera
========================
Render Frame??
Now update camera component transform:
Some other things happen
AnimBlueprints update
========================
Next Game Tick