3D object rotation between two points

I have a 3D object loaded by GLTF loader. I have two world coordinates A, B.
My object is positioned at A. My camera is looking at my object and my object is looking at camera using obj.lookAt method. So there is no rotation of my object around Y-axis or Z-axis. My object has only rotation around X-axis.
Now I want to find out the angle between pointA and pointB, and rotatte my object along X-axis equal to that angle.

How I find the angle between these two points along X-axis and apply to my object.

Issue:
I cant say whats the rotation axis actually. Ideally it is X-axis, like the object is rotation back and forth towards the screen. However, i see the axes keep changing their direction. (N.B. my point A, B is continuously updaing, as well as my camera)

1 Like

Need picture
image