Mirror
Setup guide for NWH Vehicle Physics 2 multiplayer using Mirror framework.
Before starting make sure that your vehicle and scene are already set up for single-player. If not, check the Quick Start guide.
Setting up the scene
- Create a new GameObject called 'NetworkMananger'.
- Add the following components to the created object:
- NetworkManager
- NetworkManagerHUD
- TelepathyTransport (or other transport if you are not using Telepathy). In newer versions of Mirror KcpTransport is the default.
- Your object should look like this:
Setting up the vehicle
- Double click on Mirror.unitypackage (NWH\Vehicle Physics 2\OptionalPackages\Multiplayer) to import the required assets.
- Add MirrorMultiplayerVehicle component to the vehicle. This will also add necessary Mirror components automatically.
- Make sure that NetworkTransform's Client Authority field is ticked.
- Set Network Sync Interval to 0.05 (20Hz). Default value is 0.1 (10Hz) and is too low for physics objects and will result in stuttering.
- Set Compress Rotation to None.
- If you want to futher reduce stutter reduce all three Sensitivity field values.
- Save the vehicle as a prefab and assign it to
NetworkManager
's Player Prefab field. - Your vehicle configuration should now look like this: