Dynamically adjust the rotation center of the camera

The question is somewhat vague.

The mouse operates in 2d screen space. The camera is 3d. Perhaps you want to project the mouse into the world and find a vector to rotate around that position.

Now that you have a world location, you can position the camera there. Its pivot will the centre.

I don’t fully understand how it’s supposed to work but the tracing does not look right, try it like this:

The above would trace from the camera into the world along the mouse direction from the screen centre.


Perhaps you do not need to Line Trace like that, would this work:

Get the mouse click position, how to set it as the rotation center of the camera

Thank you for your reply.Sorry for the unclear description of my problem.
I can get the position of the mouse click, but I want to set it as the center of rotation.Is there any easy way.Just like a spring arm, the center of rotation of the camera is one end of the spring arm.I need to dynamically modify the rotation center, according to the mouse click position