Vector Math

Here is a list of guides on 3D vectors and points:
===Basics===
*Vectors in Project Spark
*Further explanation on what the direction of a vector means
*Displaying on screen in Project Spark
*Written tutorial on vectors
*Tutorial on barycentres (centroid)
*[distance to] tile (and how to implement it manually with the Pythagorean theorem)
===Coordinate spaces===
*Object Space:
The [object space] tile is used to get the coordinate of a point/vector in the coordinate system of your object, this is to say that the origin of the system will be your object's [position], the x axis will be [right], the y axis [up], and the z axis [forward].If you want to calculate the vector in the object space, simply write [vector] [to object space]. If you need to get the object space coordinates of a point however, calculate the offset vector from your position to the point. Then, you can use [to object space] on the vector to get the coordinates of the point in the coordinate system of the character.Use [from object space] again to get the offset with the world coordinates.
Be careful, trying to use the [to object space] tile directly on the position of the object does not work. You can only apply [to object space] and [to camera space] to a vector.Applying [from object space] to a position "pos" (relative to your character's coordinate system) works well, since it is equivalent to the vector [pos] [minus] [zero] where zero is the origin in the character's coordinate system.
*Explanations on coordinate spaces, and the behaviour of [move] in relation to these spaces, in the thread Inverting Movement Controls. There is also a showcase level Coordinate spaces to illustrate how that works and to better understand the explanations of the thread.
===Cameras===
*Boom camera pitch and yaw, target position and offset (also explains [angle between])
*Camera over the shoulder using a follow camera (read up to the last post, which corrects a few mistakes and gives the kode in Kodeshare)
===Small examples of Kode using vectors===
*Displaying a cursor on screen
*Object orbiting around another (simple but slightly inaccurate method)
*Object orbiting around another (exact method)
*Spinning an object (rotating) — this is a generalisation of "object orbiting around another"
*Reflecting
*Camera that you can rotate when holding right mouse button — uses the pitch and yaw modifiers of the boom camera
===Some tips===
*Make sure like I said in my vectors tutorial to know when you're using a point, and when you're using a vector. Some functions have modifiers like "toward" or "in direction". "Toward" needs a point, while "in direction" needs a vector.
*You can useWHEN DO [display] [UI element] [on screen at] [mouse position]WHEN DO [display] [mouse position] [screen centre]to know where to place your UI elements.
*Some inputs are vectors: left stick, right stick, WASD, arrow keys, D-pad. And you also have mouse position, and its modifiers "object", "terrain" or "world".If you need the left stick vector, store it in a vector variable "left stick", and use that variable, as the [left stick] tile is unstable and sometimes gives a vector with x and z coordinates, and sometimes with x and y coordinates.If you need the vector with x and z coordinates, use this Kode:[left stick (vector variable)] [equals] [left stick]And if you prefer x and y coordinates:[left stick (vector variable)] [equals] [vector rotate] [left stick]since for some reasons, [left stick] after [vector rotate] (but also after [display], and some other tiles) changes to x and y coordinates.
*If you need some randomness, there's a [random vector] tile. It has lots of modifiers, so make sure to check them out.
*Object relative vectors like "forward", "up", etc., the camera vector "camera forward", and world relative vectors like "east", "world up", etc. are normalised vectors (they have a length of 1). For example, setting forward to 2*forward won't do anything.
===Math courses (expands on the various vector tutorials from a mathematical point of view)===
*Vector maths – a primer for games programmers
*2D Transformations (translations, rotations, reflections) explained in a simple way, with drawings and exercices at the end- Video courses on 2D and 3D vectors:
**Linear Algebra: Geometry and Algebra of Vectors | Basics
**Calculus III (Multivariable Calculus): 2D vectors. Calculus III: Two Dimensional Vectors, from 11 Calculus III: Two Dimensional Vectors (Level 1 of 13) | Basics to 20 Calculus III: Two Dimensional Vectors (Level 10 of 13) | Unit Vector Examples, you can continue up to the 23rd video (Level 13 of 13) for three videos on the applications of vectors in Physics.
**Calculus III (Multivariable Calculus): 3D vectors. The videos that are relevant to what you will need for Project Spark's use of vectors are:
***the videos 1, 2, 4, 6 1 Calculus III: Three Dimensional Coordinate Systems (Level 1 of 10) | Basics, 2 Calculus III: Three Dimensional Coordinate Systems (Level 2 of 10) | Equations, 4 Calculus III: Three Dimensional Coordinate Systems (Level 4 of 10) | Midpoint, Distance Formulas, 6 Calculus III: Three Dimensional Coordinate Systems (Level 6 of 10) | Distance Formula Examples for the whole courses, the videos 24, 25, 26 Calculus III: Three Dimensional Vectors for a review and some examples, and the videos 27, 28, 29, 30 Calculus III: The Dot Product for a detailed course on the dot product
*Video 3D Transformations (goes extensively on 3D rotation, and the use of [pitch], [yaw], [roll] with [world relative] or the default [object relative])
Source: http://forums.projectspark.com/yaf_postsm88328_vectors-guide.aspx#post88328