Orientation

Measures the orientation and acceleration of the device.

Properties

Name
Data Type
Range

Orientation

Quaternion

x, y, z, w (-1 to 1)

Acceleration

Vector3

x, y, x (-30 to 30)

What does the data mean?

The orientation comes in as Quaternion data which Unity uses under the hood for Game Object rotation. Acceleration is on three axes. The z axis is through the back to the front (side with ports) of the device, the x is through the left and right side of the device, and the y is through the bottom and top of the device.

Check Mirror on the object the Orientation script is attached to and the object will mirror the Device's orientation.

Code

using Magic;

public class Demo : MonoBehaviour
{
    // create a reference to the algorithm
    public Magic.Algorithms.Orientation orientation;
    
    void Start()
    {
    }
    
    void Update()
    {
        // access the property of the algorithm
        Quaternion spatialData  = orientation.orientation;
        Vector3 movement = orientation.acceleration;
    }
}

Last updated