# Vectors

Lots of people get worked up about choice of coordinate systems. Lots of people think they're all equally good, so why get worked up. I'm in the camp that making some good decisions keeps stuff from being confusing or surprising later on.

I'm a big fan of "right handed" coordinate systems. At some level, this choice is arbitrary, but the places where right handed coordinates are prominently used are places I tend to respect more, including most of the academic literature that I've read.

From there, the next big choice is whether up/down should be Z or something else. I really believe that you should have Z being the least significant of your three coordinates, assuming a 3d project, or the most different. This leads to Z being either up or down for world and object coordinates. I make a special exception for cameras, where the image plane makes sense (to me) to be the X/Y plane, and Z makes sense to go into the scene. Again, Z is the most different in this case, so it's holding true to that part, even though it means you have to do a coordinate transform to flip your axes around. But you're probably going to do some sort of camera transform anyway, so get over it.

## Vector Coordinates

### For a camera:

X right

Y down

Z in to the scene

### For a planet:

X through the prime meridian and the equator

Y through 90 degrees East of the prime meridian

Z through the North Pole

### For a city

X: East

Y: North

Z: Up

### For a mobile game object:

X right

Y forward

Z up


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dave-lecompte.gitbook.io/gamedev-book/math/math-vectors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
