Cinemachine
![]() | CinemachineCollider Class |
An add-on module for Cinemachine Virtual Camera that post-processes
the final position of the virtual camera. Based on the supplied settings,
the Collider will attempt to preserve the line of sight
with the LookAt target of the virtual camera by moving
away from objects that will obstruct the view.
Additionally, the Collider can be used to assess the shot quality and
report this as a field in the camera State.

SystemObject Object
Component
Behaviour
MonoBehaviour
CinemachineCinemachineExtension
CinemachineCinemachineCollider
Component
Behaviour
MonoBehaviour
CinemachineCinemachineExtension
CinemachineCinemachineCollider
Namespace: Cinemachine
Assembly: Cinemachine (in Cinemachine.dll) Version: 2.0.0.0 (2.0.0.0)

[DocumentationSortingAttribute(15f, DocumentationSortingAttributeLevel.UserRef)] [ExecuteInEditMode] [AddComponentMenu("")] [SaveDuringPlayAttribute] public class CinemachineCollider : CinemachineExtension
Cinemachine.CinemachineCollider = function(); Type.createClass( 'Cinemachine.CinemachineCollider', Cinemachine.CinemachineExtension);
The CinemachineCollider type exposes the following members.

Name | Description | |
---|---|---|
![]() | DebugPaths | Inspector API for debugging collision resolution path |
![]() | VirtualCamera | Get the associated CinemachineVirtualCameraBase (Inherited from CinemachineExtension.) |

Name | Description | |
---|---|---|
![]() | Awake | Connect to virtual camera pipeline.
Override implementations must call this base implementation (Inherited from CinemachineExtension.) |
![]() | CameraWasDisplaced | See whether the virtual camera has been moved nby the collider |
![]() | GetAllExtraStatesT | Ineffeicient method to get all extra state infor for all vcams.
Intended for Editor use only, not runtime!
(Inherited from CinemachineExtension.) |
![]() | GetExtraStateT | Because extensions can be placed on manager cams and will in that
case be called for all the vcam children, vcam-specific state information
should be stored here. Just define a class to hold your state info
and use it exclusively when calling this. (Inherited from CinemachineExtension.) |
![]() | IsTargetObscured | See wheter an object is blocking the camera's view of the target |
![]() | OnDestroy | Cleanup (Overrides CinemachineExtensionOnDestroy.) |
![]() | PostPipelineStageCallback | Callcack to to the collision resolution and shot evaluation (Overrides CinemachineExtensionPostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCoreStage, CameraState, Single).) |

Name | Description | |
---|---|---|
![]() | m_AvoidObstacles |
When enabled, will attempt to resolve situations where the line of sight to the
target is blocked by an obstacle
|
![]() | m_CameraRadius |
Camera will try to maintain this distance from any obstacle.
Increase this value if you are seeing inside obstacles due to a large
FOV on the camera.
|
![]() | m_CollideAgainst | The Unity layer mask against which the collider will raycast. |
![]() | m_Damping |
The gradualness of collision resolution. Higher numbers will move the
camera more gradually away from obstructions.
|
![]() | m_DistanceLimit |
The raycast distance to test for when checking if the line of sight to this camera's target is clear.
|
![]() | m_MaximumEffort |
Upper limit on how many obstacle hits to process. Higher numbers may impact performance.
In most environments, 4 is enough.
|
![]() | m_MinimumDistanceFromTarget | Obstacles closer to the target than this will not be seen |
![]() | m_OptimalTargetDistance | If greater than zero, a higher score will be given to shots when the target is closer to
this distance. Set this to zero to disable this feature |
![]() | m_Strategy | The way in which the Collider will attempt to preserve sight of the target. |
