# Smooth Actor Movement when "SetReplicatingMovement()" = true

**URL:** <https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896>\
**Category:** C++\
**Tags:** projectile-movement, Replication, unreal-engine, Multiplayer, question, replicating\
**Created:** [December 17, 2023, 2:01pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896 "2023-12-17T14:01:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ackyshacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ackyshacky/32/600284_2.png) [@ackyshacky](https://forums.unrealengine.com/u/ackyshacky)\
**Post date:** [December 17, 2023, 2:01pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/1 "2023-12-17T14:01:01Z")

</div>

I have an actor that is thrown from a character. The actor replicates fine to other clients and it moves smoothly, but it doesn’t replicate the movement. If I put `SetReplicatingMovement(true)`, it replicates the movement fine, but then the movement of the actor is very choppy on other clients machines.

How can I replicate the movement of the actor while keeping the smooth behavior?

---

<div class="post-metadata">

**Author:** ![ackyshacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ackyshacky/32/600284_2.png) [@ackyshacky](https://forums.unrealengine.com/u/ackyshacky)\
**Post date:** [December 20, 2023, 7:35pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/2 "2023-12-20T19:35:53Z")

</div>

No answers for this?  
I thought this was a common issue in multiplayer games…

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 20, 2023, 7:47pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/3 "2023-12-20T19:47:03Z")

</div>

a) what movement component are you using? (Floating, Character, Vehicle, Custom?)  
b) what method are you using to introduce the movement? Add input, change of velocity, are you changing the character location?  
c) Are you making changes on the client or server?

You could be setting different values on client and server and then the client might be fighting the information it receives from the server making it jittery.

If it has the character movement then use add input on the character.

---

<div class="post-metadata">

**Author:** ![ackyshacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ackyshacky/32/600284_2.png) [@ackyshacky](https://forums.unrealengine.com/u/ackyshacky)\
**Post date:** [December 20, 2023, 8:19pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/4 "2023-12-20T20:19:18Z")

</div>

Thanks for the response.

a) No movement component is used. The actor is a bomb that attaches to a character.  
b) When I release the bomb, I first detach it from the character using the `DetachFromActor` function. I then do `GetItemMesh()->AddImpulse()` to throw the bomb  
c) I run these functions in a multicast. I don’t want to do it only on the server because if there is significant lag, it won’t be a good experience for the player. I want to throw it both locally and on the server. I guess some kind of client-side prediction is needed?

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [December 20, 2023, 8:38pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/5 "2023-12-20T20:38:33Z")

</div>

If you are going the route of multicast then you would need the motion to be deterministic to have the same outcome on all clients (not in the case of ue4’s physics).

In this case you are replicating the object → server is tracking the location / rotation / scale and you are simultaneously giving it separate orders from the multicast.

So the bomb is constantly self correcting for motion it receives from the server.

There are network predictive algorithms in the engine in an experimental phase so they are not production ready.

You could try turning off movement replication just before the impulse and once it comes to a halt, re-enable it, but this might cause position snapping / rubber banding.

Personally I would try using “Predict Projectile Path” to get the motion on the server and maybe send out the vectors to the clients and have them play out the motion locally or just do it solely on the server (at least the client wouldn’t fight the server for dominance).

Multicast is mostly used for non-critical effects / sounds.

Also this GDC talk might help you

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/4/1/5411e34e3333fa85096441f510ae25693aa9a93b.jpeg "Math for Game Programmers: Predictable Projectiles") ](https://www.youtube.com/watch?v=6OkhjWUIUf0)

Tutorial is a little long but projectile movement with set velocity can also work in mp

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/5/0e56d13f5e8aafb825ea2359cbe26f5f8678df67.jpeg "Unreal Multiplayer FPS #6 - Throwing Grenades") ](https://www.youtube.com/watch?v=hVijpgisbQ8)

Though part way through he should have passed in the player character and add it to the grenades ignore actor when moving list instread of moving the start offset. Didn’t watch all the way through but the mp part seemed reasonable.

---

<div class="post-metadata">

**Author:** ![ackyshacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ackyshacky/32/600284_2.png) [@ackyshacky](https://forums.unrealengine.com/u/ackyshacky)\
**Post date:** [December 20, 2023, 10:58pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/6 "2023-12-20T22:58:03Z")

</div>

Thanks for the references.  
I guess this kind of implementation is not a trivial as I thought 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 19, 2024, 10:59pm UTC](https://forums.unrealengine.com/t/smooth-actor-movement-when-setreplicatingmovement-true/1532896/7 "2024-01-19T22:59:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
