CinemachineCollider Class

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.
Inheritance Hierarchy
SystemObject  Object
    Component
      Behaviour
        MonoBehaviour
          CinemachineCinemachineExtension
            CinemachineCinemachineCollider

Namespace:  Cinemachine
Assembly:  Cinemachine (in Cinemachine.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
[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.

Properties
  NameDescription
Public propertyDebugPaths
Inspector API for debugging collision resolution path
Public propertyVirtualCamera
Get the associated CinemachineVirtualCameraBase
(Inherited from CinemachineExtension.)
Top
Methods
  NameDescription
Protected methodAwake
Connect to virtual camera pipeline. Override implementations must call this base implementation
(Inherited from CinemachineExtension.)
Public methodCameraWasDisplaced
See whether the virtual camera has been moved nby the collider
Protected methodGetAllExtraStatesT
Ineffeicient method to get all extra state infor for all vcams. Intended for Editor use only, not runtime!
(Inherited from CinemachineExtension.)
Protected methodGetExtraStateT
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.)
Public methodIsTargetObscured
See wheter an object is blocking the camera's view of the target
Protected methodOnDestroy
Cleanup
(Overrides CinemachineExtensionOnDestroy.)
Protected methodPostPipelineStageCallback
Callcack to to the collision resolution and shot evaluation
(Overrides CinemachineExtensionPostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCoreStage, CameraState, Single).)
Top
Fields
  NameDescription
Public fieldm_AvoidObstacles
When enabled, will attempt to resolve situations where the line of sight to the target is blocked by an obstacle
Public fieldm_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.
Public fieldm_CollideAgainst
The Unity layer mask against which the collider will raycast.
Public fieldm_Damping
The gradualness of collision resolution. Higher numbers will move the camera more gradually away from obstructions.
Public fieldm_DistanceLimit
The raycast distance to test for when checking if the line of sight to this camera's target is clear.
Public fieldm_MaximumEffort
Upper limit on how many obstacle hits to process. Higher numbers may impact performance. In most environments, 4 is enough.
Public fieldm_MinimumDistanceFromTarget
Obstacles closer to the target than this will not be seen
Public fieldm_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
Public fieldm_Strategy
The way in which the Collider will attempt to preserve sight of the target.
Top
See Also