If you have an enemy β player vector, you basically have a translation that you can apply to the enemy to make him move to the players position. You need to go back to βoneβ by normalizing the vector, which will set the length of the vectors to β1β, but still point in the direction of the player, then you can multiply this value by the speed that you really want the vector to translate the enemy to move it towards the player
As people have already said - to get a unit you need to sum the products of both components of the vector, and then take the square root. This is due to the Pythagorean theorem, for example:
If you take the components of a vector, say
(2,2)
What was that:
2 ^ | | --> 2
And then draw a line between the beginning (0,0) and the point where the vector ends - you get a triangle ...
2 ^ /| / | --> 2
This row represents the magnitude of the vector, you take the sum of the squares of both components and then sqrt to get the length of this row:
2 * 2 + 2 * 2 = 8
sqrt(8) = 2.82
Thus, this vector is 2.82, which means that values ββ2 and 2 are 2.82 times the size of one unit vector
To get components whose length is "1" or "one", we need to normalize the vector - we do this by dividing each component by the value
2 / 2.82 = 0.70
Which sounds right - I know that the angle of this vector is 45 degrees (up 2 to 2 should be an ideal diagonal), so you can check it with cosine or sine, since cosine / sine provides a horizontal or vertical unit of length component of the vectors for given angle
sin(45) or cos(45) = 0.70
Spot on
So, now you know that the angle to the player uses a vector of length 1 with the following components
(0.7, 0.7)
To move the enemy 3 units to the player, you simply multiply the components by 3
0.7 * 3 = 2.1
So,
(2.1, 2.1)
Will move the enemy 3 units to the player at this stage of physics.
Does it help at all?