---
title: Coordinate systems
product: SpeedTree Runtime SDK
version: '10'
latest_version: '10'
status: This page documents version 10. The latest version is 10.
canonical: https://docs.unity.com/en-us/speedtree-runtime-sdk/10/coordinate-systems
latest_url: https://docs.unity.com/en-us/speedtree-runtime-sdk/10/coordinate-systems.md
last_updated: 2026-11-20
generated_at: 2026-11-20T20:14:32.726Z
locale: en-us
---

# Coordinate systems

> Because the SpeedTree run-time is not a complete game engine in and of itself, it must work well with multiple engines and engine configurations.

Supporting multiple engines and engine configurations means working with numerous coordinate systems.

The default coordinate system used by the Runtime SDK is right-handed with Z considered "up." If this is your coordinate system, no changes will be necessary. If not, you'll need to use the system described below to establish your coordinate system.
Example code is provided for the following coordinate systems:

![Diagrams of left-handed and right-handed coordinate systems, each with Z-up and Y-up variants.](/api/media?file=speedtree-runtime-sdk/10/media/images/diagram_coordinates.png)

## Accessing materials

Include `Core/CoordSys.h` to access the coordinate conversion system. The `CCoordSys` class is used for most operations, starting with selecting the desired coordinate system. `CCoordSys::SetCoordSys()` allows the client application to select a preset coordinate system or define their own. The presets are in the enumeration `ECoordSysType`:

* ST\_COORD\_SYS\_RIGHT\_HANDED\_Z\_UP (default)
* ST\_COORD\_SYS\_RIGHT\_HANDED\_Y\_UP
* ST\_COORD\_SYS\_LEFT\_HANDED\_Z\_UP
* ST\_COORD\_SYS\_LEFTT\_HANDED\_Y\_UP
* ST\_COORD\_SYS\_CUSTOM

The Runtime SDK defines an abstract base class for defining a coordinate system conversion object. The listing is below:

```cpp
///////////////////////////////////////////////////////////////////////  
//  Class CCoordSysBase

class CCoordSysBase
{
public:
virtual st_bool      IsLeftHanded(void) const = 0;
virtual st_bool      IsYAxisUp(void) const = 0;

virtual Vec3         ConvertToStd(st_float32 x, st_float32 y, st_float32 z) const = 0;
virtual Vec3         ConvertFromStd(st_float32 x, st_float32 y, st_float32 z) const = 0;

virtual const Vec3&  OutAxis(void) const = 0;
virtual const Vec3&  RightAxis(void) const = 0;
virtual const Vec3&  UpAxis(void) const = 0;

virtual st_float32   OutComponent(st_float32 x, st_float32 y, st_float32 z) const = 0;
virtual st_float32   RightComponent(st_float32 x, st_float32 y, st_float32 z) const = 0;
virtual st_float32   UpComponent(st_float32 x, st_float32 y, st_float32 z) const = 0;

virtual void         RotateUpAxis(Mat3x3& mMatrix, st_float32 fRadians) const = 0;
virtual void         RotateUpAxis(Mat4x4& mMatrix, st_float32 fRadians) const = 0;
virtual void         RotateOutAxis(Mat3x3& mMatrix, st_float32 fRadians) const = 0;
virtual void         RotateOutAxis(Mat4x4& mMatrix, st_float32 fRadians) const = 0;
```

## Shaders

The shader source uses the macros `ST_COORDSYS_Z_UP`, `ST_COORDSYS_Y_UP`, `ST_COORDSYS_RIGHT_HANDED`, and `ST_COORDSYS_LEFT_HANDED` that are each defined as true or false and are set at shader compilation time, based on the coordinate converter functions `CCoordSysBase::IsYAxisUp()` and `CCoordSysBase::IsLeftHanded()`. Difficulties may arise here with custom coordinate systems. By default (right-handed, z-up), these macros are set to:

| **Macro**                   | **Default Value** |
| --------------------------- | ----------------- |
| ST\_COORDSYS\_Z\_UP         | true              |
| ST\_COORDSYS\_Y\_UP         | false             |
| ST\_COORDSYS\_RIGHT\_HANDED | true              |
| ST\_COORDSYS\_LEFT\_HANDED  | false             |
