Hi everyone.
I am calling this function in the Tick function in a multiplayer game:
void AShooterCharacter::RunChargeAttack(float DeltaTime)
{
if (bMovePlayer)
{
GetCharacterMovement()->AddForce(1000.f * (TargetChargeLocation - GetActorLocation()));
}
}
TargetChargeLocation is a desired location (i.e., TargetChargeLocation = GetActorLocation() + 1000.f * GetActorForwardVector()
). The goal is just to move a pawn smoothly in the forward direction.
So when there is no lag, the movement on the local client is happening very nice and smooth. But when I add lag, the movement starts getting very jittery on the local client side. I presume that I have to use some kind of client prediction (like “x = x0 + vt”), but not sure how to implement this. Any clues?