I created a new actor in C++ and Add a UStaticMeshComponent as its RootComponent like below:
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh Component"));
MeshComp->SetCollisionObjectType(ECC_WorldStatic);
MeshComp->SetCollisionResponseToAllChannels(ECR_Block);
MeshComp->SetCollisionResponseToChannel(ECC_Visibility, ECR_Ignore);
MeshComp->SetCanEverAffectNavigation(false);
MeshComp->SetSimulatePhysics(true);
MeshComp->bGenerateOverlapEvents = true;
RootComponent = MeshComp;
Then, I set replicate of this actor:
bAlwaysRelevant = true;
SetReplicates(true);
SetReplicateMovement(true);
After done that all, This actor CAN NOT synchronize movement in client when moved on the server side.
Finally, I added code below:
MeshComp->SetIsReplicated(true);
As a result, Actor movement was synchronized, But still reminds two questions:
A) Why SetReplicates(true) doesn’t work.
B) Actor twinkles when moving in client, any idea to make it move more smooth ?
It has wasted a lot of time, please help me, appreciates for your reply.