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.

https://github.com/EpicGames/UnrealE...lMath.cpp#L339

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.

I hope someone can enlighten me.

https://github.com/EpicGames/UnrealE...lMath.cpp#L339

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.

I hope someone can enlighten me.

## Comment