Moving the cube on the client only

I changed my code so the client is moving the box but not the server. I thought that the server would overwrite the box’s location, but that didn’t happen. the box seems to move on the client while actually reaming still on the server. the client character can’t interact with the box where it appears to be. However, I noticed that should the server character jump onto the box he appears on the box in the client where ever the box happens to be. I must conclude from this that the character location is local/relative to the object they are standing on.

Yes.

That’s why we have SetReplicates and SetReplicateMovement to true. It tells all clients that MY (the server) version of this actor is the correct version, and I will tell you what its real properties are and what it’s position is.

Moving the position on the client only (by using “if (!HasAuthority())” ) will look like it works, but because it doesn’t match up with what the server thinks, the character and anything else will fail to interact with it’s newly updated local position and properties that don’t come from the server. The character’s position and properties are constantly being monitored by the server to ensure that the clients can’t create or modify any information that isn’t actually there for the server.

This is what I perceived from it, and hopefully, it’ll help you understand it better too :slight_smile:

Privacy & Terms