Direction to an object

Started by
2 comments, last by jonbell 20 years, 11 months ago
Given a 3D positional vector p1 which also has an accompanying directional vector v1, how can i make p1''s direction vector point at any arbitary point? To put this in more of a context p1 is the position of an enemy in a 3d landscape, the enemy has a position and a ''look'' vector. I want to set that look vector to point to any point i pass the function.
Advertisement
guy.directionVector = thingToLookAt.position - guy.position;
guy.directionVector.Normalize();
I cannot believe its that simple, i''ve been calculating angles between axes and all friggin sorts. Thx Man
well, it depends on how your direction vector is like. if it is just a x,y,z pointing in the direction, then it should work... unless i incidently swapped thingToLookAt and guy positions

This topic is closed to new replies.

Advertisement