Last modified 5 years ago Last modified on 2012-08-06 11:31:13


Manages the vehicle-specific camera settings, including mirror cameras, vehicle cameras and view parameters.

This script is added to the root GameObject of the vehicle.

Fixed cameras

Vehicle-specific cameras typically included in the vehicle's hierarchy. They are intended to show a simultaneous, additional view to the main camera so their Normalized View Port Rect property must be configured accordingly (i.e. [0, 0, 0.25, 0.25] for the lower left corner of the screen). The cameras are controlled from CameraControl.

The fixed cameras don't really need to be "fixed": they can have their own scripts, be attached to joints, or even be placed outside the vehicle's hierarchy.

showFixedCams: enables or disabled the current fixed camera for this vehicle.

startupFixedCam: camera index from the list of fixed cameras (below) to be selected at startup.

FixedCameras: references to the fixed cameras for this vehicle. Only one fixed camera will be enabled at a time.

MirrorLeft, MirrorRight, MirrorRear

Optional cameras that provide the rear view for the mirrors. The mirror cameras are managed from the CameraControl script, including their Target Texture, and they are displayed using GUITextures. Mirror views require Unity PRO.

View parameters

These settings are used from CameraControl for adapting the different camera modes to each vehicle.

CameraLookAtPoint: position in the vehicle where the main camera will point to. Typically is the Center of Mass (CoM), as other points may exhibit strange effects when steering or during in-air tricks.

DriverFront: position of the driver's view. The main camera will attach to it while in Driver View mode.

viewDistance (m): comfortable distance for viewing the vehicle from outside. Bigger vehicles require more distance, an vice-versa. Used in the Follow Car and Mouse View camera modes.

viewHeight (m): comfortable height for viewing the vehicle from outside. Used in the Follow Vehicle camera mode together with ViewDistance.

viewDamping: a measure of how fast the camera responds to the vehicle's rotation in the Follow Vehicle camera mode. Fast and agile vehicles require higher values (Sport Coupe), while slow vehicles require lower values (Bus).

viewMinDistance, viewMaxDistance (m): distance limits to the vehicle in the Mouse View camera mode.