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.
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
[Serializable]
public struct LensSettings
Fields
Dutch
The dutch (tilt) to be applied to the camera. In degrees
Declaration
[Tooltip("Camera Z roll, or tilt, in degrees.")]
public float Dutch
Field Value
Type | Description |
---|---|
float |
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 |
---|---|
float |
FieldOfView
This is the camera vertical field of 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.
Declaration
[Tooltip("This setting controls the Field of View or Local Length of the lens, depending on whether the camera mode is physical or nonphysical. Field of View can be either horizontal or vertical, depending on the setting in the Camera component.")]
public float FieldOfView
Field Value
Type | Description |
---|---|
float |
ModeOverride
Allows you to select a different camera mode to apply to the Camera component when Cinemachine activates this Virtual Camera.
Declaration
[Tooltip("Allows you to select a different camera mode to apply to the Camera component when Cinemachine activates this Virtual Camera.")]
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 |
---|---|
float |
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 |
---|---|
float |
PhysicalProperties
The physical settings of the lens, valid only when camera is set to Physical mode.
Declaration
public LensSettings.PhysicalSettings PhysicalProperties
Field Value
Type | Description |
---|---|
LensSettings.PhysicalSettings |
Properties
Aspect
For physical cameras, this is the Sensor aspect.
For nonphysical cameras, this is the screen aspect pulled from the camera, if any.
Declaration
public float Aspect { get; }
Property Value
Type | Description |
---|---|
float |
Default
Default Lens Settings
Declaration
public static LensSettings Default { get; }
Property Value
Type | Description |
---|---|
LensSettings |
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; }
Property Value
Type | Description |
---|---|
bool |
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; }
Property Value
Type | Description |
---|---|
bool |
Methods
AreEqual(ref LensSettings, ref LensSettings)
Compare two lens settings objects for approximate equality
Declaration
public static bool AreEqual(ref LensSettings a, ref LensSettings b)
Parameters
Type | Name | Description |
---|---|---|
LensSettings | a | First LensSettings |
LensSettings | b | Second Lens Settings |
Returns
Type | Description |
---|---|
bool | True if the two lenses are approximately equal |
CopyCameraMode(ref LensSettings)
Copy the properties controlled by camera mode. If ModeOverride is None, then some internal state information must be transferred.
Declaration
public void CopyCameraMode(ref LensSettings fromLens)
Parameters
Type | Name | Description |
---|---|---|
LensSettings | fromLens | The LensSettings from which we will take the info |
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, float)
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 |
float | t | The interpolation value. Internally clamped to the range [0,1] |
Returns
Type | Description |
---|---|
LensSettings | Interpolated settings |
Lerp(in LensSettings, float)
Lerp the interpolatable values. Values that can't be interpolated remain intact.
Declaration
public void Lerp(in LensSettings lensB, float t)
Parameters
Type | Name | Description |
---|---|---|
LensSettings | lensB | The lens containing the values to combine with this one |
float | t | The weight of LensB's values. |
PullInheritedPropertiesFromCamera(Camera)
In the event that there is no camera mode override, camera mode is driven by the Camera's state.
Declaration
public void PullInheritedPropertiesFromCamera(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()