Hi,
I have a class inheriting from AActor that contains two components defined in the constructor:
YagBoxComponent = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, TEXT("BoxComponent"));
YagBoxComponent->SetIsReplicated(true);
SetRootComponent(YagBoxComponent);
YagBoxComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
YagBoxComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block);
YagBoxComponent->SetCollisionObjectType(ECollisionChannel::ECC_WorldDynamic);
YagBoxComponent->SetBoxExtent(FVector(50.f, 50.f, 50.f));
YagActorBody = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Body"));
YagActorBody->SetIsReplicated(true);
YagActorBody->AttachParent = RootComponent;
YagActorBody->RelativeLocation = FVector(0.f, 0.f, -50.f);
YagActorBody->SetRelativeScale3D(FVector(1.f, 1.f, 1.f));
So that the UBoxComponent is handling the collisions and the UStaticMeshComponent is displayed in game.
The object is spawned on the server at runtime and can be moved using this RPC:
void AYagActor::ServerMove_Implementation(FVector Velocity)
{
AddActorWorldOffset(Velocity, true);
}
Everything works fine, the object is spawned on every clients and can be moved.
The problem is that “something” is left at the exact spawn location.
When any client-character comes at the spawn location of the AActor (after the AActor has been moved away), there is glitch in the character movement, like if it was going through some invisible wall.
The object contains only 2 components and both of them are moving correctly (collisions are working fine and i double checked by showing the UBox ingame), so what can be this “invisible something” that is left behind and never moves ?
This happens when the Box component is set to collide (block all or block dynamics, etc.), not when it is set to only overlap.
Am i missing some hidden component or is there something wrong going on here ?
Thanks
Cedric