Class CinemachineCollider
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
Inherited Members
Namespace: Cinemachine
Assembly: solution.dll
Syntax
[DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
[AddComponentMenu("")]
[ExecuteInEditMode]
public class CinemachineCollider : CinemachineExtension
Fields
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 | Objects on these layers will be detected. |
m_Damping | How gradually the camera returns to its normal position after having been corrected. Higher numbers will move the camera more gradually back to normal. |
m_DampingWhenOccluded | How gradually the camera moves to resolve an occlusion. Higher numbers will move the camera more gradually. |
m_DistanceLimit | The raycast distance to test for when checking if the line of sight to this camera's target is clear. |
m_IgnoreTag | Obstacles with this tag will be ignored. It is a good idea to set this field to the target's tag |
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 be ignored |
m_MinimumOcclusionTime | Don't take action unless occlusion has lasted at least this long. |
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_SmoothingTime | Smoothing to apply to obstruction resolution. Nearest camera point is held for at least this long. |
m_Strategy | The way in which the Collider will attempt to preserve sight of the target. |
m_TransparentLayers | Objects on these layers will never obstruct view of the target. |
Properties
Name | Description |
---|---|
DebugPaths | Inspector API for debugging collision resolution path |
Methods
Name | Description |
---|---|
CameraWasDisplaced(ICinemachineCamera) | See whether the virtual camera has been moved nby the collider |
GetCameraDisplacementDistance(ICinemachineCamera) | See how far the virtual camera wa moved nby the collider |
GetMaxDampTime() | Report maximum damping time needed for this component. |
IsTargetObscured(ICinemachineCamera) | See wheter an object is blocking the camera's view of the target |
OnDestroy() | Disconnect from virtual camera pipeline. Override implementations must call this base implementation |
PostPipelineStageCallback(CinemachineVirtualCameraBase, Stage, ref CameraState, float) | Callback to do the collision resolution and shot evaluation |