Project-Wide Surface Settings
Last updated
Last updated
In order to add surface-specific properties that affect the vehicle behavior, open the Package Settings window.
Open the window by going to Tools -> CustomVehicleController -> Package Settings.
You will see a foldout where you can:
Enable/Disable this feature
Associate the physic material and the surface properties
Disabling the project-wide surface settings means that when the wheels will ask for properties depending on the physic material that they hit with raycast, they will get the default surface with
0 Surface Roughness
1 Acceleration Friction
1 Steering Friction
0 Surface Drag
Surface Roughness - defines how bumpy the surface is. This is purely for a shaking visual effect, which can be enabled on the CarVisualsEssentials component. Acts as a shaking effect strength multiplier.
Acceleration Friction - a multiplier to the car's acceleration friction.
Steering Friction - a multiplier to the car's steering friction.
Surface Drag - additional drag to the car's rigidbody. The actual amount that will be added to the rigidbody is scaled with the amount of wheels on this surface, so for the full effect all the wheels must be in contact, otherwise the effect will be lessened.
Acceleration and Steering Friction parameters affect only the wheels that are actually in contact with this surface.
To add the new surface setting, click the "New Surface Property" Button.
To remove the setting, click on the "X" button on the right of the setting.
After you create a new entry to the surfaces list, assign a physic material.
Modify the parameters
Assign the physic material to the road's collider component
The actual values on the Physic Material have no effect on the vehicle's behavior. However, they still affect how the car responds to the collisions, therefore you can modify the Physic Material properties and lower them to reduce the negative impact on the ground collisions that reduce the car's speed, therefore making the driving less fun and more slow.
If you leave the physic material field as NULL in the Project-Wide Surface Settings tab, when the surface parameters will be requested by the wheel, it will receive the default (0,1,1,0) surface properties, even if you set your own surface properties.
The physic material and surface settings are stored as 2 separate lists, which get converted to the dictionary at runtime. Therefore, you cannot have the same physic materials in the list because a dictionary can only have unique keys. If you have more than 1 physic material in the list, only the first one will be added to the dictionary.
You can check the Scriptable Object that holds the project surface settings at "CustomVehicleController/VehicleController/Resources". Since the amount of items in lists must match, this asset is read-only and can only be modified from the settings window.
In order to create new Physic Materials, click RMB in the Assets folder and navigate: