Rotating around a pole based on input and screen orientation/direction.

In a nutshell, I’m trying to recreate pole climbing similar to that of Super Mario 64. I have a character who can grab a pole and rotate around it. The player can rotate the camera around the player a full 360 degrees. I’ve attached a screenshot. Here’s my problem - right now I’m rotating around the pole using RotateAround:

 transform.RotateAround(position, Vector3.up, (lookDir.x * 150f) * Time.deltaTime);

This works, but doesn’t take into consideration the screen orientation.

Think about it like this: if the camera is directly BEHIND the character and you press left, you would expect the character to rotate towards their left (and towards the screen’s left side). If the camera is directly IN FRONT of the character and you press left, you would expect the character to rotate towards their right (and towards the screen’s left side - the second image illustrates this).

Have you tried using the Cameras transform.right and -transform.right instead of lookDir.x???

Figured it out. I got the angle between the white line and the character’s forward vector. lookDir is probably a bad name for this variable - it simply points left or right relative to the camera depending on player input. This snippet handles the case when the player is pressing the left key.

float angle = Vector3.Angle(transform.right, lookDir);
if (horizontal < 0)
        {
            if(angle > 90)
            {
                //rotate to character's left
                transform.RotateAround(position, Vector3.up, 50 * Time.deltaTime);
            }
            else if(angle < 90)
            {
                //rotate to character's right
                transform.RotateAround(position, Vector3.up, -50 * Time.deltaTime);
            }
        }