Version 1 (modified by edy, 13 years ago) (diff) |
---|
CameraControl
Controls the main camera of the scene, providing different views and camera options.
The main camera is a GameObject at the top level of the scene containing a Camera component. You can configure the camera's parameters as usual. The script expects the following components to be also present:
CamSmoothFollow
CamMouseOrbit
CamSmoothLookAt
CamFreeView
CamFixTo
CamSmoothLookAtPointFromPos
These scripts provide the camera modes. They are controlled from CameraControl. Note that some of them are scripts from the Standard Assets with specific adjustments and modifications.
Camera modes
CameraControl provides six different camera modes, which are invoked from CarInput through the public functions Next and SwitchTo:
0 - Driver's View (CamFixTo)
1 - Follow Vehicle (CamSmoothFollow)
2 - Mouse View (CamMouseOrbit)
3 - Static Position (CamSmoothLookAt)
4 - Free Camera (CamFreeView)
5 - Vehicle To Vehicle (CamSmoothLookAtPointFromPos)
In the live demo you can use the keys C or F1-F6 to select the camera mode. Press H for help on further keys that controls the camera's movement and zoom.
CameraControl parameters
The CarInput script controls most of these parameters according to the user's input.
Target: reference to the vehicle that is being followed. It must contain a CarCameras component.
Target2: optional reference to a secondary vehicle to be used in the Vehicle to vehicle mode.
MapCamera: optional reference to a camera showing a mini map. This camera is an orthographic camera with a SmoothFollow script configured to keep the camera pointing down above the vehicle.
defaultCamera: camera mode to be used at startup.
showMirrors: enables the mirrors (if available) in the Driver's view.
MirrorLeftTex, MirrorRightTex, MirrorRearText: optional references to the GUITexture components that show the mirror images. Their containing GameObjects must have their transform configured to locate the textures properly on the screen.
enableImageEffects: determines whether the referenced in the ImageEffects list (below) are enabled or not.
ImageEffects
You can include the image effects of your choice (Component > Image Effects at Unity) in the main camera's GameObject. Optionally, you can reference these image effects here. This will allow all the effects to be enabled or disabled with the enableImageEffects property, providing a "low quality" mode for the camera.
The live demo uses two image effects, ColorCorrectionCurves and ContrastStretchEffect. The "low quality mode" can be toggled with the key F12, which also disables the shadows.