Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualCruis.In

Posted 03 January 2013 - 01:12 PM

ok to normalize a vector

 

divide its x,y by its length

 

the vector in our example is -5,5 (vector towards target from player)

 

length = sqr( (-5 * 5) + (5 * 5))

 

length = sqr ( 25 + 25)

 

length = sqr (50)

 

length = 7.07

 

didn't you make a mistake in your magnitude calculation? since the brackets must be added before you find the square root?

 

normalized = -5/7.07 = -0.7

5/7.07 = 0.7

 

 

This is the cosine of the angle between you, and cos(90degrees) = 0, so they are perpendicular to your facing.

 

 

now that part I do not get. Could you word that better?


#2Cruis.In

Posted 03 January 2013 - 12:14 PM

ok to normalize a vector

 

divide its x,y by its length

 

the length in our example is -5,5 (vector towards target from player)

 

length = sqr( (-5 * 5) + (5 * 5))

 

length = sqr ( 25 + 25)

 

length = sqr (50)

 

length = 7.07

 

didn't you make a mistake in your magnitude calculation? since the brackets must be added before you find the square root?

 

normalized = -5/7.07 = -0.7

5/7.07 = 0.7

 

This is the cosine of the angle between you, and cos(90degrees) = 0, so they are perpendicular to your facing.

 

now that part I do not get. Could you word that better?


#1Cruis.In

Posted 03 January 2013 - 11:31 AM


If you are facing northeast, your direction vector would be in the direction of (+1, +1), normalised this gives (1/sqrt(2), 1/sqrt(2)).

 

where does normalize come from and how does (1/sqrt(2) come into it?

 

when you normalize the vector of enemy from you which is (-5,5) how do you get (-1/sqrt(2), 1/sqrt(2))


PARTNERS