x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Strange client replication jitter.

Hello everybody,

I'm running into an incredibly annoying issue that has me perplexed. The aim is to have my character follow the cursor and rotate around it and have this replicate for every player. It does this, however there seems to be a very strange location jitter on the client's perspective. The rotation replicates just fine, however the location is what seems to jitter whilst it is moving. Here is my code, if anybody can point me in the direction of where/how to fix this it would be greatly appreciated!

 void ASkyDiveCharacter::OnRep_PosChange()
 {
     SetActorLocation(CurrentPosition);
 }
 
 void ASkyDiveCharacter::OnRep_RotChange()
 {
     SetActorRotation(CurrentRotation);
 }
 
 void ASkyDiveCharacter::MoveForward(float Value)
 {
     if (!Controller || Value == 0.0f) return;
 
     ASkyDivePlayerController* PlayerController = Cast<ASkyDivePlayerController>(GetController());
     if (PlayerController)
     {
         FVector mouseLocation, mouseDirection;
         PlayerController->DeprojectMousePositionToWorld(mouseLocation, mouseDirection);
 
         FVector EndLoc = mouseLocation + mouseDirection * 10000;
 
         FCollisionQueryParams Sky_TraceParams = FCollisionQueryParams(FName(TEXT("Sky_Trace")), true, this);
         Sky_TraceParams.bTraceComplex = true;
         Sky_TraceParams.bTraceAsyncScene = true;
         Sky_TraceParams.bReturnPhysicalMaterial = false;
 
         FHitResult RV_Hit(ForceInit);
 
         GetWorld()->LineTraceSingle(
             RV_Hit,
             mouseLocation,
             EndLoc,
             ECC_Visibility,
             Sky_TraceParams
             );
 
         if (Role != ROLE_Authority && IsLocallyControlled())
         {
                 FVector RotVec(GetActorLocation() - RV_Hit.Location);
                 float    BreakVecRot(FMath::RadiansToDegrees(FMath::Atan2(RotVec.Y, RotVec.Z)) * 1 - 90);
 
                 FVector BreakVec(0, RV_Hit.Location.Y, RV_Hit.Location.Z);
 
                 SetActorLocation(FMath::VInterpConstantTo(GetActorLocation(), BreakVec, Value * 260, 5));
                 //SetActorRotation(FRotator(0, 0, BreakVecRot));
 
                 SetActorRotation(FMath::RInterpTo(GetActorRotation(), FRotator(0, 0, BreakVecRot), Value * 3, 5));
         }
 
         if (Role < ROLE_Authority)
         {
                 FVector RotVec(CurrentPosition - RV_Hit.Location);
                 float    BreakVecRot(FMath::RadiansToDegrees(FMath::Atan2(RotVec.Y, RotVec.Z)) * 1 - 90);
 
                 FVector BreakVec(0, RV_Hit.Location.Y, RV_Hit.Location.Z);
 
                 ServerMoveForward(FMath::VInterpConstantTo(CurrentPosition, BreakVec, Value * 260, 5), FMath::RInterpTo(CurrentRotation, FRotator(0, 0, BreakVecRot), Value * 3, 5));
         }
 
     }
 }
 
 bool ASkyDiveCharacter::ServerMoveForward_Validate(FVector Location, FRotator Rotation)
 {
     return true;
 }
 
 void ASkyDiveCharacter::ServerMoveForward_Implementation(FVector Location, FRotator Rotation)
 {
     SetActorLocation(Location);
     CurrentPosition = GetActorLocation();
 
     SetActorRotation(Rotation);
     CurrentRotation = GetActorRotation();
 }

 void ASkyDiveCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
 {
     Super::GetLifetimeReplicatedProps(OutLifetimeProps);
 
     DOREPLIFETIME(ASkyDiveCharacter, CurrentPosition);
     DOREPLIFETIME(ASkyDiveCharacter, CurrentRotation);
 
 }

Product Version: Not Selected
Tags:
more ▼

asked May 23 '15 at 05:17 PM in C++ Programming

avatar image

BannockUK
13 2 5 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question