Hello,
I have Inverse Kinematics set up on my characters but for some reason the non authority clients get this weird bug :
It does not happen with the player controlled character so I am assuming this is a replication issue.
Here is how is declare the few variables I am using :
// Kinematics
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKCapsuleOffset;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKInterpSpeed;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKFrontLeftOffset;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKFrontRightOffset;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKBackLeftOffset;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKBackRightOffset;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
float IKTraceDistance;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
FVector IKFrontLeftEffector;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
FVector IKFrontRightEffector;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
FVector IKBackLeftEffector;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Kinematic)
FVector IKBackRightEffector;
// End Kinematics
And the IK code :
FVector LeftSocketLoc = GetMesh()->GetSocketLocation(LeftSocket);
FVector RightSocketLoc = GetMesh()->GetSocketLocation(RightSocket);
float NewOffset = 0.0f;
if (LeftSocketLoc.Z < RightSocketLoc.Z)
NewOffset = DistanceToGround(LeftSocket);
else
NewOffset = DistanceToGround(RightSocket);
IKCapsuleOffset = FMath::FInterpTo(IKCapsuleOffset, NewOffset, Delta, IKInterpSpeed);
GetMesh()->SetRelativeLocation(FVector(RelativeMeshLocation.X, RelativeMeshLocation.Y, RelativeMeshLocation.Z - IKCapsuleOffset));
float LeftOffset = IKTraceFoot(LeftSocket, IKTraceDistance);
float RightOffset = IKTraceFoot(RightSocket, IKTraceDistance);
IKBackLeftOffset = FMath::FInterpTo(IKBackLeftOffset, LeftOffset, Delta, IKInterpSpeed);
IKBackRightOffset = FMath::FInterpTo(IKBackRightOffset, RightOffset, Delta, IKInterpSpeed);
If I remove the GetMesh()->SetRelative… line I get a bug that happens on both the client and the server so it’s probably somewhere in this code that something gets replicated.
Anyway to prevent this replication from happening ?
Thanks,
Max