M4 - Vectors Flashcards
What is a Vector
an object that has both MAGNITUDE & DIRECTION
Just an x, y (z) value
What does a Vector represent?
absolute position
offset from another point
orientation of something
What is the formula of vector subtraction
Direction = EndPoint - StartPoint
D = (Bx-Ax, By-Ay) //Move from A to B
How can we move incrementally between two objects?
Interpolation
What is interpolation?
Taking 2 data points, plus some ratio, and calculating an “in-between” value.
What is a UNIT VECTOR?
A Vector with a magnitude of 1
How do we calculate “movement” vectors
Get direction vector (Target - Start)
Normalize that vector to magnitude of 1
Scale that vector by some speed/rate variable
What is interpolation, and what 3 pieces of data do we need to perform this calculation?
Start + Distance * Ratio
What’s the vector relative to by default?
The origin (0, 0)