I’m trying to visualize solving these issues with vectors, such as the dot product. I just can’t seem to visualize the position of gameObjects as quantities with a direction. If I wanted the Dot Product of an object at (2,4,0) and another object at (5,2,0), how can I draw that out on paper with the direction?
The language you use in your question I think is complicating things. A vector3 can represent an object in r3 space, but usually with dot products it helps to think of it as an actual vector (the physics concept, not the data structure).
That is, the vector you’re using in a dot product conveys a direction and a magnitude, not just an x,y,z value in r3 space. Think of it as the line from 0,0,0 to the position of that x,y,z position. The magnitude is just the length of this line. This makes adding, subtracting, and more complex operations much easier to visualize.
“If I wanted the Dot Product of an
object at (2,4,0) and another object
at (5,2,0), how can I draw that out on
paper with the direction?”
- Draw a line from 0,0,0 to 2,4,0. Call it ‘a’.
- Draw a line from 0,0,0 to 5,2,0. Call it ‘u’.
- Draw the projection of line a onto line u, as depicted here (this image doesn’t use the exact coordinates from your example).
Think of it as “how far the first vector goes in the direction of the second vector”. Note that this means a.u is different than u.a.
Practical uses:
- quantity is positive if the two vectors are pointing in similar directions (acute angle)
- quantity is zero if they are perpendicular (on any plane)
- quantity is negative if the two vectors are pointing away from each other (obtuse angle)
Unity’s official docs were a good, brief refresher course for me on this.
http://docs.unity3d.com/Documentation/Manual/UnderstandingVectorArithmetic.html
For a deeper study, the Kahn academy videos on this are excellent. They can be a little more “abstract math” oriented, but he does a great job of walking through vectors, vector math, and how to gain an intuitive sense of vector math, i.e. what a vector operation “means”.
You can jump straight to his lecture on vector dot product and cross product intuition, but I advise building up to it.