Is there a hidden component in AActor?

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

Hey -

It sounds as though the collision is not being updated on the clients end. To test this there are a few questions I have:

Does the server-character run into the “ghost” component as well as the client-characters?

Do the clients behave the same when colliding with the actor before it has been moved?

Do all players (client and server) run into the actor at the new location after being moved?

When you show the UBox ingame are you able to see it on both server as well as clients?

Cheers

Hey ,

Thanks a lot, you did it again !

I am developping/playing/testing in dedicated server mode and didn’t even think about server-side testing, shame on me !

Everything was perfect on the server, no ghost.
On server and client, the object, when moved, was behaving perfectly, and could collide with all characters. Both its components (UBox and static mesh) behaved perfectly everywhere (client, server). Nothing wrong noticeable in client/server/movement/collisions, no strange behavior, except, of course, for the ghost on clients.

Your questions did put me on the track of a replication problem, so I blindly added:

bReplicateMovement = true;

and it worked, first try, problem solved !

Still, i am super surprised by two things:

This is only an actor, with no movement component that i know of, and i move it only by updating its location (through AddActorWorldOffset function), so i thought i could stop worrying about movement replication.

And the biggest surprise: is the movement an actual solid being that other actors can bump into ??? That’s a shock !

So the problem is solved, but i have the feeling i missed the point and still don’t understand what is/was going on.

So if you have some time to clarify, that would be very interesting and helpful. If you don’t, no prob, thank a zillion for your help, again !

Cheers

Cedric

Hey -

What possibly happened is that the server told the clients that ObjectA exists (at original location). Then the server updates and tells the clients that there is an object elsewhere (at the new location) but did not specify that the new object IS ObjectA. This would cause the clients to both see the object at the new location as well as believe that there is still something at the original location.