# Replicate static mesh rotation

**URL:** <https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, Replication, local-host, unreal-engine, Blueprint, question\
**Created:** [August 26, 2018, 2:08am UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460 "2018-08-26T02:08:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 26, 2018, 2:08am UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/1 "2018-08-26T02:08:01Z")

</div>

i have a cube inside my character that rotates towards the mouse location with this function

 ![251595-unr.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/e/4bef5c0c13d564890df3f0025897707bf9ca41f5.png)

my player and the cube has replication enabled but currently the server is the only one replicating his rotation…  
with this i mean that the clients get the rotation of the host, but they don’t get the rotation of the other clients

how do i solve this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 26, 2018, 2:20am UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/2 "2018-08-26T02:20:28Z")

</div>

also the host is not getting the rotation of the clients

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [August 27, 2018, 7:51pm UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/3 "2018-08-27T19:51:07Z")

</div>

Replication always only happen from the server to the clients never from a client to a server. If you set a replicated variable client-side the server never knows about it because a client can’t replicate things on itself. What you have done is fine you just need to send the rotation through a RunOnServer event and also set it on the server. Then if the cube component is set to replicate and the Character it lives on is also set to replicate + replicate movement then the server will finish the replication back to the other clients.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 8:09pm UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/4 "2018-08-27T20:09:26Z")

</div>

so i can do this with a RunOnServer and a multicast(i could even disable the cube replication this way) but what about the send rate? if i send this rotation every client’s tick then wouldn’t that saturate the server? like what would happen if the client haves 600fps, it would be calling that function 600 times per second?

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [August 27, 2018, 8:38pm UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/5 "2018-08-27T20:38:14Z")

</div>

Yes you should not send the updates more often than needed however if you got the bandwidth it is the simplest way of doing it. If you want to do it a more bandwidth friendly way you would have the CPU predict the rotation between server updates. It quickly becomes very complicated as you can see in the CharacterMovementComponent that does a lot of work to make it as smooth as possible.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 8:58pm UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/6 "2018-08-27T20:58:20Z")

</div>

so what would be the best approach to set a fixed send rate for the rotation?

have a float variable that increases with deltaTime and when it reaches a number set it to 0 and send the data?

having an infinite while with a delay node?

use a timer?

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [August 27, 2018, 9:22pm UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/7 "2018-08-27T21:22:45Z")

</div>

You could use a looping “Set Timer By Event” node and have it send the RunOnServer RPC if there is any significant change since the last sent rotation. You could pause it when no movement is happening and immediately wake it up again (set + resume) when movement is detected.

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [December 7, 2018, 2:53am UTC](https://forums.unrealengine.com/t/replicate-static-mesh-rotation/432460/8 "2018-12-07T02:53:01Z")

</div>

And you can always lerp the rotation between its current rot and the rot received in the replicated variable or multicast. That way the rotation is happening smoothly on The clients even though the updates of where it should rotate to only happen every 1/4 second.
