The problem of the horizontal game camera's own X-axis following rotation

In a side-scrolling game, the camera is attached to the character with a spring arm. Now, when the character is standing on a wall, the character’s gravity is perpendicular to the wall. I want to calculate and set the relative rotation of the camera or the world rotation of the camera using the character’s up vector or gravity direction. How should I write the blueprint? I’ve asked AI for a long time but couldn’t complete it. It seems that this is the only way to calculate it, as other methods would cause problems when the character turns around.

The problem has been solved. Just use “Make Rot from XZ”.