Replication problem: Rotation is different between server and clients

The problem I have right now is that the rotation of the replicated actor(the ballon weapon) is different between server and clients.

All clients see the same rotation (I tried it with 2 clients and the server), however the server see a different rotation (as you can see in the picture)

Here is what I’m trying to do.
I pick up the weapon. (attach the skeletal mesh to the player socket)
I press a key to throw it. (detach the skeletal mesh and add impulse to simulate a throw)
I expect the transformation of the object are same for server and client. It seems I have some problem with the rotation, the location seems replicated fine.

The actor I have has a SkeletalMesh from the infinity blade set.

The way I try to sync the transformation is like this… When I throw the weapon, the tick will track the position of the skeletal mesh and set it to a variable called “server transform”. That variable is “RepNotify”, which tries to sync the transformation to all clients. It’s somewhat working so far…

When I log the transformation detail of the weapon Actor, defaultSceneRoot and Skeletalmesh, they show the same transformation on both server and clients.

Previous to this, I tried attach/detach to actor, but I couldn’t able to get it work as far as right now. Maybe I did something wrong. Also, using “replicate movement” doesn’t seem do anything when I throw the weapon.

Please help me out. Thanks. Let me know if you need more details.

Is your weapon in a Blueprint? If so what is the parent of the Blueprint?

I would use SkeletalMeshActor and when you throw the weapon set it to simulate physics and have the Replicates and Replicates Movements ticked.

I always found it hard to replicate the movement of just Actors I always have to make them StaticMeshActors or SkeletalMeshActors.

Try just this on its own, let us know how you get on.

Edit: Websense at work showed your picture after a restart and I can see you’re using ‘Actor’ as the parent, click File > Reparent and select SkeletalMeshActor

Thanks Conkeyball!

The SkeletalMeshActors suggestion works with replicate movement checkbox. I cleaned up the tick and server transformation repnotify. :smiley:

However, the difference is still there. You can see that client 1 and 2 are on the same rotation, but server is on a different rotation. I added a couple arrows to make it look obvious. You can see that the server has its rotation off by 90degree from the blue arrow. Client 1 and 2 have the correct rotation.

When I pick up the weapon, the server rotation corrects itself (the mesh overlaps the blue arrow). It’s off by 90 degree again once I detach it.

9a59e714b2bccd84ec1bbabb52ba58bda2542742.jpeg

When you ‘throw’ the object are you just detaching it from the socket and adding impulse? Or are you setting it to simulate physics too?

If you’re not simulating physics please try this. It sounds like some other code is at work here…

I would just literally do the event ‘Throw’ > Detach from socket > Simulate Physics.

Forget the impulse for now and see if you still get the same response

I do have simulate physic enabled before applying impulse. Otherwise, the weapon would just detach and locked at its position.

Here is the simulate physic and impulse, which run on server…

The following is weapon detach multicast event (“Throw Weapon All” call in previous picture)

The weapon rotation on server changes as soon as the weapon detached from its parent. Change the boolean on the detach from parent doesn’t help.

The issue is fixed after I check “No Skeleton Update” for the SkeletalMeshComponent. I wonder why it behave like that… lol…