by skydereign » Wed Jan 09, 2013 5:03 am
Do you know what vectors are? Visually think of them as arrows to a point (starting at the origin). All vectoradd does is add the second vector to the first one. Visually this is the same thing as moving the start of the second arrow from (0,0) to the end of the first vector. Now the first vector is set equal to the new end point.
For example... adding vectors (1,1) and (2, 0). Putting the end of (2,0) to (1,1) would make it (3,1).
Mathematically is actually easier in this case. Just add the two x values together, and the two y values together. So vector one will now be set equal to (2+1, 1+0) = (3, 1). You probably noticed the function uses double* for the first two values. This allows the function to actually change the values of the first two numbers within the function. The script reference has a good demo of what you might use it for.