# Vector Directions

(Redirected from Technical:Vector Directions)

Vector Directions, within the context of HeroEngine, are a mathematical term used to describe coordinates which gives a position relative to the origin that something in the game world is moving or pointing. It can also be used to represent rotations, depending on context. Some vector directions are in degrees, such as spherical coordinates, and others are more of an xyz format.

## Overview

There are many specialized functions to deal with a 3D game world. Variables that hold 3D coordinates are of a data type called Vector3.

In a 2D world, coordinates can be represented with X and Y coordinates. In a 3D world, the coordinates are X, Y, and Z. Imagine a character standing up with their back to you. The Y-axis is lined up with their spine. If they hold up their right arm and point straight out to their right, that's lined up with the X-axis. And the direction of their gaze straight ahead is the Z axis.

Usually the easiest way to think about these axes is with degrees. So a point in space that was 45 degrees above the horizon might be represented with coordinates of (0, 45, 1). Though we should use floating point values for these numbers: (0.0, 45.0, 1.0). Instead of (X, Y, Z), another way of referring to these values is: (PolarAngle, Azimuth, Distance).

HeroScript, however, doesn't deal with degrees. It deals with vectors, which are normalized to a value of 1. It's beyond the scope of this wiki to go into the details of 3D vectors, but if you would like to learn more, it is recommended that you do some Google searches for online tutorials on 3D Graphics. For example, this page has some simple definitions: http://viz.aset.psu.edu/gho/sem_notes/3d_fundamentals/html/geometry_def.html

To convert degrees into vector3 values, the simplest method is to use one of the appropriate exposed functions.