I need to change the FOV of my weapon camera but do not know how to reference a camera.
Something like this?
// Drag the camera you want here in the editor.
public Camera cam;
void Awake(){
cam.fieldOfView = 90.0f;
}
You need a Camera variable to hold the Camera you wish to modify.
I am not sure what scripting language you are using, so I shall just put down Java, and C# examples.
C#:
public Camera myCamera;
// Then, to modify the camera's FOV, do this:
myCamera.fieldOfView = 10f;
Java:
public var: Camera: myCamera;
// Then, to modify the camera's FOV, do this:
myCamera.fieldOfView = 10f;
First of all you have to set your camera in to 3D projection = perspective
then u get the FOV option!!!
public Camera camera;
void Awake()
{
camera.fieldofView = 15f;
}