public virtual void LateUpdate() { if (this.target) { this.x = this.x + ((Input.GetAxis("Mouse X") * this.xSpeed) * 0.02f); this.y = this.y - ((Input.GetAxis("Mouse Y") * this.ySpeed) * 0.02f); this.y = OrbitCamera.ClampAngle(this.y, this.yMinLimit, this.yMaxLimit); Quaternion rotation = Quaternion.Euler(this.y, this.x, 0); Vector3 targetPos = this.target.position + this.targetOffset; Vector3 direction = rotation * -Vector3.forward; float targetDistance = this.AdjustLineOfSight(targetPos, direction); this.currentDistance = Mathf.SmoothDamp(this.currentDistance, targetDistance, ref this.distanceVelocity, this.closerSnapLag * 0.3f); this.transform.rotation = rotation; this.transform.position = targetPos + (direction * this.currentDistance); } }