Different Physics Behavior on Client and Host
Background first, I've got a pretty low level of competence with networking in general, and I'm trying to problem solve as I go. I'm working in Unet with the addition of the Mirror HLAPI to simplify some elements.
In my project, I'm trying to allow players to move around in vehicles, which are also moving themselves. Because of my lack of familiarity with networking, I've been taking small deliberate steps to add functionality in the hope I wouldn't create too many problems. What I started with was player movement, making sure that all replicated properly - no issues there. Next step was adding in a placeholder vehicle, something which the players would stand on and be able to move around on. Took a while to get the relative movement and gravity working to my satisfaction, but eventually got it working.
Now I'm stuck, because for some reason the vehicle's movement is physically interacting with the player objects in different ways on the client and the host, from the host's perspective, the vehicle and players remain in their correct positions; but on the client, moving the vehicle adds a force that never dissipates, so the player objects float off into space.
This probably has something to do with the fact that I'm parenting the player objects to the vehicle, and the weirdness therein, but I wasn't exactly sure what the best practices are for how to manage creation of these features.
To give specific details, my player prefab is made up of two a parent and a child: the parent object contains networking components, and the majority of other scripts, while the child object contains the player's visual representation, and is what the player actually moves and controls. When a player enters a vehicle, in order to keep make sure that the player moves relative to the vehicle, I've been parenting the player to the vehicle, which is what I would usually do in a non-networked environment.
This is my first interaction here, and I've tried to give a good description, but please let me know what additional information would be helpful in addressing this, thanks in advance for your help.
Your answer
Follow this Question
Related Questions
How to implement NetCode to Unity physics (new one, with Havok) 0 Answers
Multiplayer Physics interaction 2 Answers
Unity 5 Physics on the Server but not on the Client 0 Answers
Adding Force over network 0 Answers
Getting Values In Unity From Webpage 0 Answers