From 8886e7a7a2a8cb4af76922116d6b9c09c0a16e47 Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Tue, 3 Mar 2026 11:37:59 +0100 Subject: [PATCH] Client: override actor rotation with smoothed yaw to eliminate body mesh jitter Previous fix only smoothed cascade inputs (head/eyes) via SmoothedBodyYaw but the body mesh still followed the raw replicated actor rotation which jumped at ~30Hz network rate. Now the client calls SetActorRotation with the smoothed yaw so the mesh visually interpolates. Replication overwrites on next network update; SmoothedBodyYaw absorbs the correction smoothly. Co-Authored-By: Claude Opus 4.6 --- .../Private/PS_AI_ConvAgent_PostureComponent.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_PostureComponent.cpp b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_PostureComponent.cpp index bacdf46..bb600f4 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_PostureComponent.cpp +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_PostureComponent.cpp @@ -347,6 +347,8 @@ void UPS_AI_ConvAgent_PostureComponent::TickComponent( // ── Smoothed body yaw for cascade computations ────────────────── // Server: direct copy (no lag). Client: interpolate toward replicated // rotation to avoid step artifacts from discrete ~30Hz network updates. + // The client also overrides the actor's rotation with the smoothed value + // so the body mesh doesn't visually jump at network tick rate. if (Owner->HasAuthority()) { SmoothedBodyYaw = Owner->GetActorRotation().Yaw; @@ -356,6 +358,14 @@ void UPS_AI_ConvAgent_PostureComponent::TickComponent( const float ReplicatedYaw = Owner->GetActorRotation().Yaw; const float ClientDelta = FMath::FindDeltaAngleDegrees(SmoothedBodyYaw, ReplicatedYaw); SmoothedBodyYaw += FMath::FInterpTo(0.0f, ClientDelta, SafeDeltaTime, BodyInterpSpeed * 3.0f); + + // Override actor rotation with smoothed value so the body mesh + // shows the interpolated rotation instead of the raw replicated steps. + // This is local-only — replication will overwrite on next network update, + // and SmoothedBodyYaw will absorb the correction smoothly. + FRotator SmoothedRot = Owner->GetActorRotation(); + SmoothedRot.Yaw = SmoothedBodyYaw; + Owner->SetActorRotation(SmoothedRot); } // ── 3. Compute DeltaYaw after body interp ──────────────────────────