CarWheelScript

This is the script attached to the visual component of the wheel of a vehicle. It is responsible for rotatating and translating the wheel mesh, as well as creating tire marks.

Variables
Wheel Col - The wheel collider of this wheel.

Car - The vehicle object this wheel is attached to.

Does Skid - Does this wheel leave tire marks?

Screech - The screeching audio source. Can be null.

Suspension Type - Determines how the camber of the wheel is altered when the suspension is compressed.

0 - No camber change.

1 - Negative camber gain on compression.

2 - Positive camber gain on compression.

Vehicles with less than 3 wheels can only use suspensionType 0.

Camber Factor - Angle offset for the camber change; this is only valid if the suspension type is greater than zero.

Is Smooth - Should the tire marks use a smoother texture?

Popped - Is the wheel popped?

Tire - The tire object, this is deactivated when the tire is popped. Can be null; if it is null, the wheel will not be capable of blowing out.

Spark - The sparks particle system for when the tire is popped. Can be null.

Pop Sound - The popping sound's audio source. Can only be null if tire is null.

Hit Snd - The collision audio source of the tire. Can be null.

Tire Snd - The audio clips for hitSnd.

Rim Snd - The audio clip for the rim collision sound.

Rim Scrape - The audio clip for the rim scraping sound.

Hidden Variables
These are variables which are not visible in the inspector, yet useful for writing scripts.

delta - Delta time multiplier for events in Update.

fixedDelta - Multiplier for events in FixedUpdate.

carScript - The VehicleParent script of the vehicle.

wheelScript - The CarWheelColScript of the wheel collider.

skidding - Is the wheel currently leaving a tire mark?

curMark - The current tire mark being created.

Functions
PopTire - Pops the tire, only works if tire and popSound are not null.

FixTire - Replaces the tire if popped.