I have written a server event that takes in a character, animal, and player controller which executes from the player controller. I have a problem where when I run this event, it takes in the right character and animal and attaches it to the component on the animal, but the server only replicates this to the player that called the function. The other clients move the character to the spot but don’t weld the character to the animal so they get thrown off and then move around the map oddly.
Meanwhile the character that called the function is mounted perfectly fine. Is this a bug? If a server event was executed properly wouldn’t that mean it would be replicated to all clients in exactly the same manner?
The picture shows the character mounted properly on the top client, but on the second client, being thrown off after trying to attach (bottom picture).
Has anyone found a work around for this ? I find any AttachToComponent call does not work correctly on clients but the server renders it correctly.
What is also strange is I am using AttachToComponent on my player weapon and those attach correctly.
The primary difference is the Weapon is a straight up AActor with either a skeletalmesh ( bow ) or a static mesh ( sword ).
The mount and the player are both ACharacter classes so I feel like there may be something there causing the strange behavior on clients. Possession works no problem though.
You first need to disable the collision on the character mounting your bear
You then need to de-activate player movement as gravity will still impact your player position
Please note that my Horse Character has a collision profile of Vehicle hence the collision ignore statement
Snippet #1
if(CurrentState == EPlayerState::MOUNTED)
{
// this is needed as gravity will affect the player character
GetMovementComponent()->Deactivate();
GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Ignore);
GetMesh()->SetCollisionResponseToChannel(ECC_Vehicle, ECR_Ignore);
}