Hey @RastaCat33 !
I check you code.
I would recommend not calculate the gravity in each client.
Just calculate it in the server or in the server and wait for the OnRep is calling.
Avoid using RPC if is possible.
In the function calculate gravity do you know if is being called on client?
void APlanetUniversMediepolysCharacter::CalculateGravity()
{
if (IsValid(planetGravity)) {
// Ensure the gravity is only applied if the component is active
if (planetGravity->GetGravityEnabled())
{
if (planetGravity->ApplyGravity())
{
SphericMovement->UpdateGravityDirection(planetGravity->GetNewGravityDirection());
if (GetLocalRole() == ROLE_AutonomousProxy && !HasAuthority())
{
UE_LOG(LogTemp, Warning, TEXT("Client (%s): Sending gravity update to the server."), *RoleString);
//Server_SendGravityUpdate(planetGravity->GetNewGravityDirection());
Server_SendGravityUpdateToServer(planetGravity->GetNewGravityDirection());
}
}
}
}
}
Are those if valid in client?
- IsValid(planetGravity)
- planetGravity->GetGravityEnabled()
- planetGravity->ApplyGravity()
Did you try to remove all related to replication and calculate in each client?
void APlanetUniversMediepolysCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//Remove this if
if (HasAuthority() || (IsLocallyControlled() && GetLocalRole() == ROLE_AutonomousProxy))
{
CalculateGravity();
}
}
This will help you to find the issue
Let me know if that help you to find the issue. If not I can help you go a lither further.