Component Replication with Simulated Physics [bug]

Component replication bug after Set Simulated Physics to true.
Steps to reproduce:

  1. Create new blueprint actor (1st image), set Replicates true. Add one scene component (I’ve tryed few other types, same result) as root component, add and attach 1 Static Mesh Component, choose mesh in property (use settings - e.g. Simulate Physics false, Auto Weld false but any combination gives same result.
  2. Add blueprint nodes (1st image). Turn on Physics and Component replication.
  3. Place blueprint on level (2nd image). Look on coordinates.
  4. Run game for 2 players and see location of static mesh component on server and client (3rd image). On client side root component will be in right location but any of attached components will be on wrong position which is world coordinate applyed as relative coordinate.

So world coordinate offset will be added twice to component location: first time to position it according to actor location and then adding world coordinates instead relative. It looks like a simple math mistake but realy makes unable to use Component replication with Physics simulation. Hope it can be fixed in 4.8 or kind of 4.8.1.

Below there are 3 steps(pictures) that can be easily reproduced.

Hi Trachinusdragon,

I tried reproducing this in 4.7.6 but actor location remained same for both server and client. Are you able to reproduce this in a new project, or only your current project? If you see same thing in a new project, could you upload it somewhere like Dropbox or Google Drive and give me a link so I can take a look? Thanks!

Hello, .
Actor location and root component location is same on both - client and server(so actor replication works fine) but not any of other components. I found this in my big project and then made new clean project and did screenshots you see above. Full project available [here][1] or only [blueprint][2] you need to copy to clean first person shooter Blueprint’/Game/FirstPersonBP/Blueprints/BP_test.BP_Test’.

Picture - how this project looks on my side

Hi Trachinusdragon,

Thanks for project! I spoke with developers about this and learned that only root component’s physics state is replicated. As such, physics results are not being replicated properly because your root is not simulating physics. To make this work in your test project, I bypassed Set Is Replicated for static mesh components and just used Set Simulate Physics for them on Begin Play. Then I took root mesh component and enabled Simulate Physics.

Now I’m not sure what you’re attempting to create here, but it seems like you want root static mesh to remain in place with no physics simulation, and components to react to physics. In that situation, it would be better to use two different Actor Blueprints, one for base that doesn’t react to physics, and other that does. You can then attach other to non-physics Actor, and they’ll each respond to physics as you expect.

To properly replicate change in position as a result of physics on both Server and Client, you’ll also need to make sure you’re doing all physics movement on Server. If Client is one changing behavior, you’ll need to use an RPC call to Server to have Server do it instead, because replication in UE4 runs from Server to Client, and not in reverse.

Hope that helps! Let me know if any of that wasn’t clear or you need any further assistance.

Hi , thank you for your answer.

What I’m trying to do is to create a tree constructed from static meshes which are branches, trunk and other tree parts. So I would like to get my static mesh components replicate physics separetely when I turn it on. If you have succeded with replication of physics in test project, could you please post it somewhere like Dropbox or Google Drive, because I could not make it work.

child components movement replication seems to be working properly except world location coordinates. All of them are moving same way on server and clients, but coordinates of child components are doubled. Pls look on the last picture I’ve posted.

From my point there is bug with replication: right after you turn on “set is replicated” on child componets desregarding set simulate physic is turn off or on root component - child component is shifted on + world coordinate from root component. only problem I have.

Please open attached project and run for 2 players, then shoot on server to both BP actors and see shift in coordinates I’m talking about. only problem this coordinate shift, everything else works fine!


Thanks for more detailed test project! With it I was able to confirm problem: at moment, replicating multiple physics bodies/components within one actor is not supported. developers have talked it over and will try to move bReplicateMovement flag onto component rather than actor, which would make your setup work correctly. For tracking, we’ve entered this task as UE-15343, and it sounds like we have someone ready to check something in soon.

I wouldn’t expect this to be fixed in time for 4.8, but I will see if it’s possible. In meantime, you’d have a better shot attaching actors to actors, rather than using components inside a single BP. Thanks for your report!

, thank you for your reply and task creation, this is what I need. I’m ready to do extensive testing when I have a chance to do it.

idea why I draw your attention to it - because multiple physics bodies/components within one actor almost working already and I hope UE team need not much efforts to make it 100% working. It is very cool and obvious to have feature of engine for open world and multiplayer games (lot of different objects and different behavior, but it does not mean lot of them replicate same time - so engine supported component physics replication make life much easier). I guess you can easily imagine hundreds of examples how game developers can use it.

I’m looking forward to test whenever I have chance.

I agree, and it sounds like developers want to make this work as well. I’ll let you know as soon as I have any information on update. Thanks for sticking with it!

Hello , just a kind question if this task(UE-15343) has a chance to be implemented in 4.9?

There’s a chance, but I haven’t seen any update on feature request yet. I’ve emailed developer who entered report for an update, and I’ll let you know what I find out.

Sorry for disturbing, have you received any feedback from developer yet?

Yes: it looks like this has been fixed, and fix should be in 4.8.1. I’m still testing, but it appears this is correct.

Still not working for me in UE 4.8.1. :frowning:
I used same test project I attached above.

I apologize, I was mistaken, looks like this is a 4.9 fix at earliest. I’m still confirming, but it looks like it won’t be in any 4.8 hotfixes.

, thank you for update. Hope it will be done in 4.9.

Thank you!!!

Okay, spoke with developers and it sounds like only first part of situation (PreReplication) was fixed, but Replicate Movement is still not implemented. I’ve reopened task and I will follow up when I have more information. Thanks for update!

Still not loosing hope to get this feature in 4.9 Preview 4-5. In Preview 3 I see only 2 issues was fixed that before this one - UE-15343 in number. Maybe it is good time to look on it. :slight_smile:

It looks like it’s been pushed to 4.10, as fix requires a number of risky changes, and they missed window for 4.9. I’ll let you know if I see any change.

Thank you!