Network objects don't collide correctly
Hello, I'm making an online game where cars can crash each other and other light objects (balls, boxes, etc).
Each object has an ObJectPositionScript which synchronizes the position, rotation and velocities to the other players with an unreliable uncompressed Network View. Each player owns its car, and the server owns the other objects.
I use linear interpolation but still have flickering issues. Anyway, I'm trying to fix another collision problem.
When the server car crashes another object, it gets "kicked", that is, it rolls of flies away. But client servers can't do that: the object gets displaced as the car pushes it, but when contact ends, the object seems not to have any speed. Like if the car goes fast into the ball, it jumps vertically but not horizontally.
I would think that when the client car is replicated into the server and collides an object, it would get "kicked". What could be the reason why it doesn't happen? Thanks!
Answer by NaBUru38 · Jan 04, 2016 at 09:03 PM
Hello, I added an OnCollisionEnter() to the ball.
When the server car bumps the ball, the collision relative velocity is about the same as the car speed (for example 30 m/s). But when a client car bumps the bball, the collision relative velocity is well under 1 m/s.
What could be the cause of this?
Answer by NaBUru38 · Jan 04, 2016 at 09:47 PM
Oops, my mistake. The ObJectPositionScript was serializing the object information, but the velocities variables weren't being updated.
So now I have some lag and flickering, which I hope I can fix. Bye!