Class KCCCamera
Third-person camera controller for character following, orbiting, zoom, and obstruction handling. Supports smooth movement, rotation, and framing adjustments.
public class KCCCamera : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourKCCCamera
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
DefaultDistance
[Header("Distance")]
public float DefaultDistance
Field Value
DefaultVerticalAngle
Default vertical angle for camera.
[Range(-89, 89)]
public float DefaultVerticalAngle
Field Value
DistanceMovementSharpness
Sharpness for distance movement smoothing.
public float DistanceMovementSharpness
Field Value
DistanceMovementSpeed
Speed at which camera distance changes (zoom).
public float DistanceMovementSpeed
Field Value
FollowPointFraming
[Header("Framing")]
public Vector2 FollowPointFraming
Field Value
- Vector2
FollowingSharpness
Sharpness for following movement (higher = snappier).
public float FollowingSharpness
Field Value
IgnoredColliders
Colliders to ignore when checking for obstructions.
public List<Collider> IgnoredColliders
Field Value
- List<Collider>
InvertX
[Header("Rotation")]
public bool InvertX
Field Value
InvertY
Invert vertical rotation input.
public bool InvertY
Field Value
MaxDistance
Maximum allowed camera distance.
public float MaxDistance
Field Value
MaxVerticalAngle
Maximum vertical angle for camera.
[Range(-89, 89)]
public float MaxVerticalAngle
Field Value
MinDistance
Minimum allowed camera distance.
public float MinDistance
Field Value
MinVerticalAngle
Minimum vertical angle for camera.
[Range(-89, 89)]
public float MinVerticalAngle
Field Value
ObstructionCheckRadius
[Header("Obstruction")]
public float ObstructionCheckRadius
Field Value
ObstructionLayers
Layers to check for camera obstructions.
public LayerMask ObstructionLayers
Field Value
- LayerMask
ObstructionSharpness
Sharpness for obstruction smoothing.
public float ObstructionSharpness
Field Value
RotateWithPhysicsMover
If true, camera rotates with physics mover.
public bool RotateWithPhysicsMover
Field Value
RotationSharpness
Sharpness for rotation smoothing.
public float RotationSharpness
Field Value
RotationSpeed
Speed of camera rotation.
public float RotationSpeed
Field Value
Properties
FollowTransform
The transform the camera follows/orbits around.
public Transform FollowTransform { get; }
Property Value
- Transform
PlanarDirection
The current planar (horizontal) direction of the camera.
public Vector3 PlanarDirection { get; set; }
Property Value
- Vector3
TargetDistance
The target camera distance (zoom).
public float TargetDistance { get; set; }
Property Value
Transform
The camera's transform.
public Transform Transform { get; }
Property Value
- Transform
Methods
SetFollowTransform(Transform)
Sets the transform that the camera will orbit/follow.
public void SetFollowTransform(Transform t)
Parameters
tTransformThe target transform to follow.
UpdateWithInput(float, float, Vector3)
Updates camera position and rotation based on input and deltaTime. Handles rotation, zoom, following, obstruction, and framing.
public void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)