Here is a list of guides on 3D vectors and points:


Coordinate spacesEdit

  • 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.


Small examples of Kode using vectorsEdit

Some tipsEdit

  • 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 use
    WHEN 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)Edit

  • Video 3D Transformations (goes extensively on 3D rotation, and the use of [pitch], [yaw], [roll] with [world relative] or the default [object relative])


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.