How does rotation.LookAt work?

As I am currently dealing with a problem Not In Unity I have determined that if I was in Unity I could solve the problem trivially in three lines with LookAt()

Sadly I’m not in Unity.

How does this function work?

I’m working with raw position data (x,y,z) so rotations are calculatable, but only necessary for a single virtualized object (as vector from an origin to a target). Once I have that rotation information performing a virtualized localPosition offset would be easy.

Problem is, I can’t figure out how to calculate the vector.

Does anyone know how the function actually works?

to calculate a vector from one position towards another, just subtract one from the other…

example: position 2 (0,6,10) - position 1 (0,3,3) == direction(0,3,7)

so, starting from position 1, the direction to pos 2 is (0,3,7)… does that answer your question? you can find plenty of examples online…