Download

Replication of a child static mesh (Hull --> Turret on a tank)

I’ve got some issues with replicating movement / rotation of the turret of my tank. Everything is working on the client, but it’s not getting replicated to the server / to other clients.

For the hull I use methods which call the charactermovement, but I don’t see a viable option do do that for the Turret rotation since it’s relative to the rotation of the hull. :?

In the attachment you can see how i;ve buil;d up the character and the movement parts of the BP.

Add Input functions replicate value to server under the hood but your TurnTurret input event happens only on owning client. You need to send it to server and then multicast or repnotify to inform other clients of new rotation.

Ok thanks, will try to get that working tonight.

Ok got it working with MC now. Is this the cleanest I will get it?

Can you show me how it would look with repNotify? I don’t quite get how I am supposed to do that.

Send your input value to server, rotate the turret there and then multicast current turret rotation to clients, otherwise they might end up out of sync if every each is gonna rotate with delta on it’s own. What they can do on their own is lerp to updated rotation from their current one.
How it would look with rep notify? Instead of calling multicasted event on server you update value with rep notify flag there and clients receive it via notify function.

Got it working with repNotify now, just need to figure out how to smooth out the rotation on the clients. It’s a bit jittery now

my bad, actually you don’t need rep notify, just usual replicated variable and on client interpolate to it on tick for smooth rotation