Struct LensSettings
Describes the FOV and clip planes for a camera. This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active.
Namespace: Cinemachine
Syntax
[Serializable]
[DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
public struct LensSettings
Constructors
LensSettings(Single, Single, Single, Single, Single)
Explicit constructor for this LensSettings
Declaration
public LensSettings(float fov, float orthographicSize, float nearClip, float farClip, float dutch)
Parameters
Type | Name | Description |
---|---|---|
Single | fov | The Vertical field of view |
Single | orthographicSize | If orthographic, this is the half-height of the screen |
Single | nearClip | The near clip plane |
Single | farClip | The far clip plane |
Single | dutch | Camera roll, in degrees. This is applied at the end after shot composition. |
Fields
Default
Default Lens Settings
Declaration
public static LensSettings Default
Field Value
Type | Description |
---|---|
LensSettings |
Dutch
The dutch (tilt) to be applied to the camera. In degrees
Declaration
[Range(-180F, 180F)]
[Tooltip("Camera Z roll, or tilt, in degrees.")]
public float Dutch
Field Value
Type | Description |
---|---|
Single |
FarClipPlane
The far clip plane for this LensSettings
Declaration
[Tooltip("This defines the far region of the renderable range of the camera frustum. Typically you want to set this value as low as possible without cutting off desired distant objects")]
public float FarClipPlane
Field Value
Type | Description |
---|---|
Single |
FieldOfView
This is the camera view in vertical degrees. For cinematic people, a 50mm lens on a super-35mm sensor would equal a 19.6 degree FOV
Declaration
[Range(1F, 179F)]
[Tooltip("This is the camera view in vertical degrees. For cinematic people, a 50mm lens on a super-35mm sensor would equal a 19.6 degree FOV")]
public float FieldOfView
Field Value
Type | Description |
---|---|
Single |
LensShift
For physical cameras only: position of the gate relative to the film back
Declaration
public Vector2 LensShift
Field Value
Type | Description |
---|---|
Vector2 |
NearClipPlane
The near clip plane for this LensSettings
Declaration
[Tooltip("This defines the near region in the renderable range of the camera frustum. Raising this value will stop the game from drawing things near the camera, which can sometimes come in handy. Larger values will also increase your shadow resolution.")]
public float NearClipPlane
Field Value
Type | Description |
---|---|
Single |
OrthographicSize
When using an orthographic camera, this defines the height, in world co-ordinates, of the camera view.
Declaration
[Tooltip("When using an orthographic camera, this defines the half-height, in world coordinates, of the camera view.")]
public float OrthographicSize
Field Value
Type | Description |
---|---|
Single |
Properties
Aspect
Sensor aspect, not screen aspect. For nonphysical cameras, this is the same thing.
Declaration
public float Aspect { get; }
Property Value
Type | Description |
---|---|
Single |
IsPhysicalCamera
This is set every frame by the virtual camera, based on the value found in the currently associated Unity camera
Declaration
public bool IsPhysicalCamera { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Orthographic
This is set every frame by the virtual camera, based on the value found in the currently associated Unity camera
Declaration
public bool Orthographic { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
SensorSize
This is set every frame by the virtual camera, based on the value found in the currently associated Unity camera
Declaration
public Vector2 SensorSize { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Methods
FromCamera(Camera)
Creates a new LensSettings, copying the values from the supplied Camera
Declaration
public static LensSettings FromCamera(Camera fromCamera)
Parameters
Type | Name | Description |
---|---|---|
Camera | fromCamera | The Camera from which the FoV, near and far clip planes will be copied. |
Returns
Type | Description |
---|---|
LensSettings |
Lerp(LensSettings, LensSettings, Single)
Linearly blends the fields of two LensSettings and returns the result
Declaration
public static LensSettings Lerp(LensSettings lensA, LensSettings lensB, float t)
Parameters
Type | Name | Description |
---|---|---|
LensSettings | lensA | The LensSettings to blend from |
LensSettings | lensB | The LensSettings to blend to |
Single | t | The interpolation value. Internally clamped to the range [0,1] |
Returns
Type | Description |
---|---|
LensSettings | Interpolated settings |
SnapshotCameraReadOnlyProperties(ref LensSettings)
Snapshot the properties that are read-only in the Camera
Declaration
public void SnapshotCameraReadOnlyProperties(ref LensSettings lens)
Parameters
Type | Name | Description |
---|---|---|
LensSettings | lens | The LensSettings from which we will take the info |
SnapshotCameraReadOnlyProperties(Camera)
Snapshot the properties that are read-only in the Camera
Declaration
public void SnapshotCameraReadOnlyProperties(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The Camera from which we will take the info |
Validate()
Make sure lens settings are sane. Call this from OnValidate().
Declaration
public void Validate()