What is vectoradd?

Game Editor comments and discussion.

What is vectoradd?

Postby Hblade » Wed Jan 09, 2013 4:48 am

I just discovered this o.O
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: What is vectoradd?

Postby 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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is vectoradd?

Postby Hblade » Wed Jan 09, 2013 5:07 am

Ahh ok, thanks!
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest