I needed to rotate an object to the player and I looked at the blueprint code from the Blueprint office because I remembered that they had those info tables. It uses MakeFromX to rotate an object always to the player.
I am not sure if I understand the math behind it. I give it a vector that goes from the object to the player and it calculates a rotation matrix that rotates the object to the player.
But all it does is really creating two orthonormal vectors from the object-to-player vector and puts it in a matrix. How can that be the correct rotation? And it also seems to rotate around the Z and Y axis.
You might also want to look at functions like FRotationMatrix::MakeFromXZ. That will point X (forward) in the direction you want, and Z (up) will be changed as much as needed to be orthogonal to X. That way you can specify which direction to try and keep ‘upright’ in your rotation.