private void HandleCamera()
{
if (camRig == null || cam == null) return;
Quaternion pathRot;
if (camLockedOnDoor)
{
pathRot = camLockedPathRot;
}
else
{
if (activePath == null || activePath.TotalLength <= 0f) return;
Vector3 targetFwd = GetPathForward(activePath, s);
float rotT = 1f - Mathf.Exp(-cameraRotateSpeed * Time.deltaTime);
camFwdSmoothed = Vector3.Slerp(camFwdSmoothed, targetFwd, rotT);
if (camFwdSmoothed.sqrMagnitude < 0.0001f) camFwdSmoothed = targetFwd;
pathRot = Quaternion.LookRotation(camFwdSmoothed.normalized, Vector3.up);
}
Vector3 desiredRigPos = transform.position + (pathRot * camOffsetLocal);
camRig.position = Vector3.SmoothDamp(
camRig.position,
desiredRigPos,
ref camRigVel,
cameraSmoothTime
);
Quaternion desiredRigRot = pathRot * camRigRotOffset;
float rotBlend = 1f - Mathf.Exp(-cameraRotateSpeed * Time.deltaTime);
camRig.rotation = Quaternion.Slerp(camRig.rotation, desiredRigRot, rotBlend);
}