To have one object face another in a vector, given each objects 3D coordinates, you can apply to the following function for a Matrix rotation of the first to look at the second.

public static Matrix LookAt(Vector3 pos, Vector3 look)

        Matrix rot = new Matrix();

        rot.Forward = Vector3.Normalize(look - pos);
        rot.Right = Vector3.Normalize(Vector3.Cross(rot.Forward, Vector3.Up));
        rot.Up = Vector3.Normalize(Vector3.Cross(rot.Right, rot.Forward));

        return rot;

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.