Skip to content
Snippets Groups Projects
Commit 75b578ca authored by David Gilbert's avatar David Gilbert :bug:
Browse files

fix(replication): Makes ClientTransformReplication use relative position and rotation.

parent b82a2022
Branches
No related tags found
1 merge request!113Pull dev/5.4 changes into dev/5.5
Pipeline #554930 passed
......@@ -26,8 +26,8 @@ void UClientTransformReplication::UpdateState(float DeltaTime)
// Only do this if we actually replicate the actor
if (GetIsReplicated())
{
const FVector Loc = OwningActor->GetActorLocation();
const FRotator Rot = OwningActor->GetActorRotation();
const FVector Loc = OwningActor->GetRootComponent()->GetRelativeLocation();
const FRotator Rot = OwningActor->GetRootComponent()->GetRelativeRotation();
// Only update state if the local state changed
if (!Loc.Equals(ReplicatedTransform.Position) || !Rot.Equals(ReplicatedTransform.Rotation))
......
......@@ -56,7 +56,10 @@ protected:
// For now, directly apply the transforms:
auto* OwningActor = GetOwner();
if (OwningActor && OwningActor->HasValidRootComponent())
OwningActor->SetActorLocationAndRotation(ReplicatedTransform.Position, ReplicatedTransform.Rotation);
{
OwningActor->SetActorRelativeLocation(ReplicatedTransform.Position);
OwningActor->SetActorRelativeRotation(ReplicatedTransform.Rotation);
}
}
// Unreliable Server RPC that sends the transform from owning client to the server
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment