RotateAround and Character Controller

I’m trying to create a circling behavior for my AI that uses a character controller.
I’ve created a Seeking and Fleeing behavior that involves modifying the agent’s forward direction, storing it, and using it inside: CharacterController.Move(direction);

I’m not sure how to mathematically have the agent orbit around the target, so I wanted to use Transform.RotateAround, but then physics wouldn’t be checked by the character controller, and I can’t store the result of RotateAround, because it returns void.
I also want to make sure that I have the AI facing his forward direction still.

This is the code I have so far, excluding the use of Controller.Move:

 transform.RotateAround(targetPos, Vector3.up, projectedDistance * Time.deltaTime);

Any help with having my AI with a character controller rotate around a target?

=========================================================

UPDATE:

Thanks to whydoidoit, i’m getting closer to solving it. The agent moves in a circular motion while moving towards the target, but instead of a constant orbit, it stops when it gets close to the target, then runs in place.

Here is the code I have:

     public bool Circle(Vector3 targetPos)
            {
                var tempDir = (targetPos - trans.position);
                direction = new Vector3(tempDir.x, direction.y, tempDir.z);
    
                var rotDirection = RotateAbout(direction, targetPos, Vector3.up, 1);
    
                if ((tempDir.magnitude > minDistance) && tempDir.magnitude < safeDistance)
                {
                    ObstacleAvoidance(ref direction, new Vector3(2f, 1, 2f), checkObstacles);
               //Applies gravity and stuff
               CharacterBasics();
    
                    //Check for potential pitfalls
                    RaycastHit hit;
                    if (Physics.Raycast(trans.position + trans.forward, Vector3.down, out hit, 3))
                    {
                        targetSpeed = maxSpeed;
                        controller.Move((rotDirection) * Time.deltaTime);
                    }
                    else
                    { targetSpeed = 0; }
                    return false;
                }
        }

Well you could store the transform.position before you do RotateAround, then work out the difference afterwards.

Or you could use this code which returns a new position that you have to set yourself:

   static function RotateAbout(position : Vector3, rotatePoint : Vector3, axis : Vector3, angle : float) : Vector3       {
          return (Quaternion.AngleAxis(angle, axis) * (position - rotatePoint)) + rotatePoint;

   }