How to spawn physical object in MP and Replicat it to the client

HI

i looked everywhere for the answer till i get tired with no answer so I’m going to put this question here and hope someone can direct me to the right direction .

i want to make a local MP game that have 2 player , one server and the other client .
I have a blueprint that contain a static mesh box with physics enabled , and i put an event tick in the level blueprint to spawn this box to the level every 1 sec but the problem is no matter what kind of replication i do i end up to get different location of the box in the server than the client , i searched for the answer and found this “Replicating meshes affected by physics - World Creation - Unreal Engine Forums

but i couldn’t find out how to make mine like above , how can i spawn the object in the server and give the location to the client without even the client didn’t spawn the same object ?

i even looked at the 6 episode of the UE team in youtube about the MP but couldn’t find the answer .

i removed the custom event that i made to set the transform as it didn’t work for me .

pls give me a blueprint example .

thanks .

Hi mhnoni.

First, add a “Switch Has Authority”, so the box only spawn on the server.
Then, open the “Enimy” blueprint (shown at the SpawnActor node), click on the class defaults and check the box “Replicates” and “Replicate Movement”, if Replicated Movement isn’t checked, client and server will see the box at different places.
Hope this help.

Hi
Thanks for your answer but it didn’t help me as the location of the spawn of the objects still not the same between the server and the client even i did everything you said and i spent many hour to find alternative way but no luck , i uploaded my project hope you don’t mind ,its a simple project that only have above blueprint nothing more , hope you can help me and tell what i’m missing here .

23 mb MyProjectte needed fix from getanswer

thanks
MH

any update pls ?

HI

I fixed my issue by removing the scene component in my spawn object (physical object) and make the static mesh in the physical object default scene . i had no idea and why the default scene make such problem during replicating the movement of the physical object ? it gave me a headache and no once mentioned such things so hope my answer will fix problem for other people and thanks a lot guys for the support .

You are a king by having replied to you own issue when you found out the solution. I am replying just so you know that after all this years, you have helped someone with the exact same problem. Thank you <3!

1 Like