Issues with Collision Replication in Multiplayer VR Environment

Hi everyone,

At the moment, I have an issue regarding physics while developing a multiplayer application in Unreal Engine 5.3.2. To give a little bit of context, I am trying to extend Unreal’s VR Template such that it is possible to use it with location-based virtual reality. To do this, I use a listen server, connect clients to this server, and replicate their movement. Before I explain the issue that I am having, it is useful to know what I have been able to do:

  • Replicate head movement to all clients.
  • Replicate hand movement to all clients.
  • Replicate hand animations to all clients.

The next step for me is to grab an object and replicate the interaction of the client who grabbed the object with the world. It is here that I am having an issue. I am able to grab the object, which is performed on the server, and can see the client holding the object from another client as well as moving the object around. The problem is when the client who is holding the object interacts with the world. In the VR Template, there are grey cubes with yellow edges. If the client takes this object, which has a grab component attached to it, and pushes this cube towards the other cubes, then the client who is performing this action will see that the cubes are pushed away. However, on the listen server, you see that the cube is moving through the other cubes.

Some additional observations: When you grab the cube, the physics of the cube are disabled. If you release the cube, the physics are enabled again. This is interesting because when you push cubes away and release the cube on the place where the cubes that you pushed away were located, they will sweep back to their original position. I think this is the case because the state on the server was not updated, and therefore the original state is restored since the server is authoritative. Also, the cubes have no owner. If they need one, I don’t know to which actor I need to assign them to.

The Blueprint code for grabbing looks like this:

I have also set the following variables for the Grabbable_SmallCube:

  • bAlwaysRelevant = true
  • bReplicateMovement = true
  • bReplicates = true

For the StaticMesh, the following variable has been set:

  • bComponentReplicates = true

For the GrabComponent, the following variable has been set:

  • bComponentReplicates = true

Here, it is suggested to disable collisions on the client side. I have tried this, but it also didn’t solve the issue. I have tried a lot of things, but nothing seems to work. As far as I can tell, it is related to the GrabComponent because as soon as an object is grabbed, the replication is out of the window. One final thing, I have checked that collisions were still enabled even after grabbing, and this was true. Also, when an object is grabbed and its physics are turned off, the same is true for the object that the client holds.

Questions:

  1. Are there any additional steps I need to take to ensure proper physics replication in a multiplayer VR environment?
  2. Is there a specific way to handle physics interactions on the server to prevent discrepancies between the client and server?
  3. How can I debug this issue further to identify the root cause of the collision problems?

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

Switching from UE 5.4.1 to UE 5.4.2 fixed the issue.

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