diff --git a/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp b/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp index 0bce9302ae30860f0211918a620be91e9666ea21..011c83377dbcf497f2df887a00c4ec6250838275 100644 --- a/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp +++ b/Source/RWTHVRToolkit/Private/Core/ClientTransformReplication.cpp @@ -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)) diff --git a/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h b/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h index ac364067efcca3c0c21a6ae940b25ece78914647..c31ed9bd3093670ab88e5c26e38f56a68b86c2f3 100644 --- a/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h +++ b/Source/RWTHVRToolkit/Public/Core/ClientTransformReplication.h @@ -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