When dealing with voxels (and math in three-dimensional space in general), it is extremely important to get your coordinate systems and the conversions between them right. Even slightly wrong conversions can (and will) lead to massive headaches and horrible debugging sessions.
As such, it is a good idea to do one or more of these:
- Add the coordinate-system being used to every position, rotation and scale value.
- Restrict the mixing of coordinate-systems, by using a type-system that let's you create new types from existing types.
- Document the coordinate-systems of function parameters.
Now then, let's get to the various coordinate systems!
TODO: Add descriptive diagrams to all definitions.
The global coordinate system that is the entire scene. This is where almost all the (gameplay-related) math will occur.
Depending on the software you are using, this can vary wildly...
The local coordinate system of an individual chunk or object.
The inner coordinate system of an individual voxel.
The global coordinate system, as seen by a camera with some projection applied.
The global coordinate system, as seen by a camera, with no projection applied.