Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you add to vectors together, the resulting vector is the equivalent of stacking the vectors end to end. Adding vectors together can be used to simulate simple physics like the effect of wind or gravity, so for every step forward a game character might have a wind vector added to their movement vector. If a character in a game jumps while moving forward, then we will also want to add the vectors of the upward momentum movement with the forward motion, and then in reverse when they fall back down.  

a = ( 4, 8 )  

b = ( 6, -3 )

...

Multiplication only effects the magnitude of the vector, leaving the direction unchanged... However, if the vector is multiplied by a negative, then the direction is reversed! Multiplying vectors could be used to control the acceleration of space ship, without changing it's directionto simulate wind resistance or drag. If an object in a game collides with wall, we may want to multiply the objects vector by -1, to reverse it's direction so that it bounces off the surface.

...