Client tries to predict physics when it didn't happen

I was testing some things yesterday and I noticed something that doesn’t seem to have a solution in the studio. The client tries to predict a certain physics when it didn’t actually occur in the game.

The steps to reproduce are as follows:

1 - Create two collision groups(1 and 2) and make them collide.
2 - Create a collision group for the characters and don’t let them collide with the collision group(1 and 2).
3 - Assign the collision group(1) to a Part.
4 - Start the game and create a LocalScript to change the character’s collision group from the Client to the collision group(2).
5 - Use AssemblyLinearVelocity to apply force to the character’s movement while it is close to the Part.

After this, you can notice that the character will try to apply a force to the Part and the Part will start to move slightly, but after a few seconds or a certain distance, the Part will return to its real position because it is not moving, this is only happening on the Client.

Note: It is necessary to manually SetNetworkOwner() on the Part to prevent the Client from taking the collision for itself.

The idea behind this is to create a virtual collision that only works on the Client*, but this seemed like a stumbling block.

*Edit1: Exclusively on the player character, since only he should suffer the collision, not the rest of the objects in the world. (If you look closely you will be able to understand the idea)

Can you share a file that can repro the issue. Thanks!

While I was trying to make the model to show you, I couldn’t do it at all until I thought that NetworkOwner could be causing some problem.

I saw that the models changed to red in some ticks and I didn’t know what that meant.

After observing, I saw that the problem is being caused by the client “asking” the server to take care of the collision because only it has physics under the object and it gives way momentarily.

I hadn’t seen this case yet, I believe I will have to evaluate a solution for this problem. Thank you for your attention.

In fact, that’s not all. What I mentioned is still happening. I’ll make a video and show you. Switching to the server’s perspective, you can see the character moving forward, but the object doesn’t move. After a while, the character synchronizes again and changes position.

The server is not giving the collision to the client. The client seems to be taking care of the collision on its own, but it’s only happening on the client.

I worked around the problem by creating constraints with AlignOrientation and AlignPosition. The secret was to create Hitboxes that would only interact with the Client, which could move but would not be Anchored. These constraints were ideal for solving the problem.

However, it still seems to be a physics bug where the Client takes on collisions without the server giving them.

Clients will locally-simulate objects they bump into for a small amount of time to improve responsiveness until they receive updates from the Network Owner.

2 Likes

Thank you. I was already imagining that it was something intentional to reduce the physics latency that the client feels, but I needed to be sure if it was intentional or not.

By the way, I also read an excerpt that highlights what is happening:

The issue here isn’t that ownership isn’t sticking. The issue here is that when you get closer to an object someone else owns you may start to simulate it locally in approximation so that you can bump into it without weird interactions.

1 Like