Vehicle Mod Upgrade Guide (0.3.7.0)

The following is a guide on how to mod Vehicles in *Hurtworld*.

Start off by dragging both the server and client(proxy) prefabs from the project into the hierarchy so we can edit them in the scene.

**Server prefab upgrade:**

Add a vehicle passenger component to the server prefab gameobject.
The easiest way to do this is to select the prefab in the hierarchy then scroll down to the bottom of the inspector and click on the 'Add Component' button.
Start typing in 'vehiclepassenger' until its highlighted then press enter to add it to the gameobject.

You can also copy a vehicle passenger component from another vehicle thats already setup by right clicking the vehicle passenger component and selecting 'Copy Component'.
Then select your prefab, right click any component in the inspector and go to 'Paste Component As New'

After the vehicle passenger is setup you'll need to assign it to the ThisSeat property of VehicleController4Wheel. This is easiest to do by dragging the prefab from the hierarchy into the ThisSeat slot in the inspector allowing Unity to automatically setup the reference.

Next assign the DriveWheels in VehicleMotor4Wheel, click on the WheelBR and WheelBL properties to highlight them in the hierarchy then drag those wheels into the DriveWheels property. Vehicles can only accelerate if they have at least 1 drive wheel on the ground.

Next, delete the steerpoint child game object (this step isn't essential so don't worry if you can't find one, this gameobject used to mark where the steering assist force is applied but we've changed to a generic twist assist that doesn't need setup)

All the server changes have now been made, with the prefab selected in the hierarchy, scroll to the top of the inspector and click the apply button to save the changes into the prefab.

**Client(proxy) prefab upgrade:**

Add a VehiclePassenger component to the client prefab gameobject. If you've already setup the server VehiclePassenger it will be easiest to just copy it across.

Next assign the vehicle passenger to the DriverSeat property of VehicleClientSimple by dragging the prefab from the hierarchy into the DriverSeat slot

Next we have to setup the wheels again on the VehicleClientSimple component. This can be automated by right clicking the component and going to 'Update wheel data' to run this process automatically. In the screenshot below this process has already run and the wheel data under 'Depreciated Wheel Data' has been pushed into the Wheel collection just above.

Next we setup the new LOD system, this isn't essential for the vehicle to work properly but is recommended especially when large numbers of vehicles are anticipated.
start with removing the SimpleClientLod component by right clicking on it going to 'Remove Component'.
Next find the NetworkEntityManagerWorldItemProxy component and enable 'Ignore Renderers' by clicking the checkbox.

Next add a SimpleVehicleLOD component (easiest to do with add component button at bottom of inspector).
SimpleVehicleLOD switches between high/low/culled levels of detail based on how important the vehicle is (determined by both distance to player and whether it is occupied or not).
First we assign the low detail objects into the low LOD property by dragging them from the hierarchy into the 'Low Lod Renderers' property of SimpleVehicleLOD.
Next, to setup the high detail objects, right click the SimpleVehicleLOD component and go to 'auto setup high LOD'. This will put every child renderer that isn't in the low LOD group into the high LOD group, now the LOD component is setup.

All the client changes have now been made, with the prefab selected in the hierarchy, scroll to the top of the inspector and click the apply button to save the changes into the prefab.

With both server and client updated you are now ready to rebuild your vehicle mod!