Class CinemachineConfiner3D
An add-on module for CinemachineCamera that post-processes the final position of the camera. It will confine the camera's position to the volume specified in the Bounding Volume field.
Inheritance
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
[AddComponentMenu("Cinemachine/Procedural/Extensions/Cinemachine Confiner 3D")]
[ExecuteAlways]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/CinemachineConfiner3D.html")]
public class CinemachineConfiner3D : CinemachineExtension
Fields
BoundingVolume
The volume within which the camera is to be contained.
Declaration
[Tooltip("The volume within which the camera is to be contained")]
public Collider BoundingVolume
Field Value
Type | Description |
---|---|
Collider |
SlowingDistance
Size of the slow-down zone at the edge of the bounding volume.
Declaration
[Tooltip("Size of the slow-down zone at the edge of the bounding volume.")]
public float SlowingDistance
Field Value
Type | Description |
---|---|
float |
Properties
IsValid
Check if the bounding volume is defined
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
CameraWasDisplaced(CinemachineVirtualCameraBase)
See whether the virtual camera has been moved by the confiner
Declaration
public bool CameraWasDisplaced(CinemachineVirtualCameraBase vcam)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | The virtual camera in question. This might be different from the virtual camera that owns the confiner, in the event that the camera has children |
Returns
Type | Description |
---|---|
bool | True if the virtual camera has been repositioned |
GetCameraDisplacementDistance(CinemachineVirtualCameraBase)
See how far virtual camera has been moved by the confiner
Declaration
public float GetCameraDisplacementDistance(CinemachineVirtualCameraBase vcam)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | The virtual camera in question. This might be different from the virtual camera that owns the confiner, in the event that the camera has children |
Returns
Type | Description |
---|---|
float | True if the virtual camera has been repositioned |
GetMaxDampTime()
Report maximum damping time needed for this component.
Declaration
public override float GetMaxDampTime()
Returns
Type | Description |
---|---|
float | Highest damping setting in this component |
Overrides
OnTargetObjectWarped(CinemachineVirtualCameraBase, Transform, Vector3)
This is called to notify the extension that a target got warped, so that the extension can update its internal state to make the camera also warp seamlessly. Base class implementation does nothing.
Declaration
public override void OnTargetObjectWarped(CinemachineVirtualCameraBase vcam, Transform target, Vector3 positionDelta)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | The camera to warp |
Transform | target | The object that was warped |
Vector3 | positionDelta | The amount the target's position changed |
Overrides
PostPipelineStageCallback(CinemachineVirtualCameraBase, Stage, ref CameraState, float)
Callback to do the camera confining
Declaration
protected override void PostPipelineStageCallback(CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | The virtual camera being processed |
CinemachineCore.Stage | stage | The current pipeline stage |
CameraState | state | The current virtual camera state |
float | deltaTime | The current applicable deltaTime |