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 verticalFOV, float orthographicSize, float nearClip, float farClip, float dutch)
Parameters
Type | Name | Description |
---|---|---|
Single | verticalFOV | 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 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 degrees. Display will be in vertical degress, unless the associated camera has its FOV axis setting set to Horizontal, in which case display will be in horizontal degress. Internally, it is always 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 |
GateFit
For physical cameras only: how the image is fitted to the sensor if the aspect ratios differ
Declaration
public Camera.GateFitMode GateFit
Field Value
Type | Description |
---|---|
Camera.GateFitMode |
LensShift
For physical cameras only: position of the gate relative to the film back
Declaration
public Vector2 LensShift
Field Value
Type | Description |
---|---|
Vector2 |
ModeOverride
Allows you to select a different camera mode to apply to the Camera component when Cinemachine activates this Virtual Camera. The changes applied to the Camera component through this setting will remain after the Virtual Camera deactivation.
Declaration
[Tooltip("Allows you to select a different camera mode to apply to the Camera component when Cinemachine activates this Virtual Camera. The changes applied to the Camera component through this setting will remain after the Virtual Camera deactivation.")]
public LensSettings.OverrideModes ModeOverride
Field Value
Type | Description |
---|---|
LensSettings.OverrideModes |
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 half-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 readonly float Aspect { get; }
Property Value
Type | Description |
---|---|
Single |
IsPhysicalCamera
This property will be true if the camera mode is set, either directly or indirectly, to Physical Camera Do not set this property. Instead, use the ModeOverride field to set physical mode.
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. Do not set this property. Instead, use the ModeOverride field to set orthographic mode.
Declaration
public bool Orthographic { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
SensorSize
For physical cameras, this is the actual size of the image sensor (in mm); it is used to convert between focal length and field of vue. For nonphysical cameras, it is the aspect ratio.
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 | The LensSettings as extracted from the supplied Camera |
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()