My Character on the Client doesn’t seem to move as it would on the Server. It seems to itch slowly towards the location set by SimpleMoveToLocation function, without rotating or animating (except for idle animation).
On the Server, the Character behaves normally, and the only saving grace is that the client character rotates on the Server but still moves extremely slow similarly to the client.
void ACppPlayerController::Server_Move_Implementation(FVector Location)
{
// testing to see if its properly calling the server
// seems irrelevant to the issue
if (HasAuthority())
{
UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
if (!ChampionPawn)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("ChampionPawn is null"));
return;
}
if (!NavSys)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("NavSys is null"));
return;
}
if (!PathFollowingComponent)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("PathFollowComp is null"));
return;
}
const FNavAgentProperties& NavAgentProps = ChampionPawn->GetNavAgentPropertiesRef();
FNavLocation NavLoc;
FSharedConstNavQueryFilter QueryFilter;
for (int i = 1; i < 30; i++)
{
float a = 10;
FVector QExtent = FVector(a*i, a*i, 1000.f);
if (NavSys->ProjectPointToNavigation(Location, NavLoc, QExtent, &NavAgentProps, QueryFilter))
{
float FvDistance = UKismetMathLibrary::Vector_Distance(Location, ChampionPawn->GetActorLocation());
// rotates the character at a faster rate for smoother movement
// if the location is close by a certain threshold (150.f for now)
if (FvDistance < 150.f)
{
bMoveToAcquiredLocShort = true;
// rotate the character towards location
FVector PawnLoc = FVector (ChampionPawn->GetActorLocation().X, ChampionPawn->GetActorLocation().Y, 0.f);
FVector AcquiredLoc = FVector(Location.X, Location.Y, 0.f);
FRotator PawnRot = UKismetMathLibrary::FindLookAtRotation(PawnLoc, AcquiredLoc);
TargetPawnRotation = PawnRot;
}
bMoveToAcquiredLocShort = false;
// the final move command
UAIBlueprintHelperLibrary::SimpleMoveToLocation(this, NavLoc.Location);
// spawn the FX on the clicked location
Multicast_SpawnFC(Location);
break;
}
}
}
}
The setup includes a PlayerController that has a Right-Click input that samples the registered location of the linetrace from the mouse. It calls a RequestMove() function that checks Authority, implementing the logic SimpleMoveToLocation logic or calling the RPC function Sever_Move() to do the same
(The logic of which I have provided above)