View Single Post
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-02-2021 , 08:03   Re: Get direction player is moving relative to other player
Reply With Quote #4

Quote:
Originally Posted by Effeff View Post
I am guessing what I forgot to do is use NormalizeVector somewhere?
Yeah you should normalize both vectors. Dot product takes vector magnitudes into account but you're not interested in that, hence why we want unit vectors. Also you don't need the AddVectors and MakeVectorFromPoints part - attackerVel and attackerVelVec are equivalent vectors in your case. Also as you seem to have some trouble wrapping your head arounds vectors in space, read up on free and bound vectors; I think that may help you a bit. Here we are always working with free vectors - the initial point of all vectors is the world origin (0, 0, 0), so all vectors with the same direction and magnitude are equivalent.
While you may be thinking of velocity as this:

In actuality it's just this:
__________________

Last edited by klippy; 03-02-2021 at 08:13.
klippy is offline