Skip to main content
Version: 2.2.0

Haply::Inverse::Unity::CoordinateSystem::BaseCoordinateConverter

Provides methods for converting float arrays to Unity's Vector3 and Quaternion types, and vice versa, with support for custom conversion settings that adjust axis order, apply negations, and add offsets to accommodate different coordinate systems or preferences.

Inherits from ICloneable

Inherited by Haply.Inverse.Unity.CoordinateSystem.Inverse3CoordinateConverter, Haply.Inverse.Unity.CoordinateSystem.VerseGripCoordinateConverter

Public Functions

Name
Vector3FromDeviceToUnityVector3Raw(float[] floats)
Converts a raw device float array to a Unity Vector3 without applying any transformation settings.
QuaternionFromDeviceToUnityQuaternionRaw(float[] floats)
Converts a float array from the device into a Unity Quaternion using raw values without transformation.
float[]FromUnityToDeviceRaw(Vector3 vector)
Converts a Unity Vector3 to a device-specific float array without applying any transformation settings.
float[]FromUnityToDeviceRaw(Quaternion quat)
Converts a Unity Quaternion to a device-specific float array without applying any transformation settings.
Vector3FromDeviceToUnityVector3(float[] floats)
Creates a Unity Vector3 from a specified float array using the PositionSettings to apply negations, adjust the axis order, and then add an offset.
QuaternionFromDeviceToUnityQuaternion(float[] floats)
Creates a Unity Quaternion from a given float array using the RotationSettings.
float[]FromUnityToDevice(Vector3 vector)
Converts a Unity Vector3 back to a device-specific float array using the PositionSettings.
float[]FromUnityToDevice(Quaternion vector)
Converts a Unity Quaternion back to a device-specific float array using the RotationSettings.
objectClone()

Public Properties

Name
Vector3SettingsPositionSettings
QuaternionSettingsRotationSettings

Public Functions Documentation

function FromDeviceToUnityVector3Raw

static Vector3 FromDeviceToUnityVector3Raw(
float[] floats
)

Converts a raw device float array to a Unity Vector3 without applying any transformation settings.

Parameters:

  • floats The raw float array from the device, expected to have at least three elements.

Return: A Unity Vector3 constructed directly from the provided float array.

function FromDeviceToUnityQuaternionRaw

static Quaternion FromDeviceToUnityQuaternionRaw(
float[] floats
)

Converts a float array from the device into a Unity Quaternion using raw values without transformation.

Parameters:

  • floats A float array containing four elements [w, x, y, z].

Return: A Unity Quaternion constructed directly from the provided float array.

function FromUnityToDeviceRaw

static float[] FromUnityToDeviceRaw(
Vector3 vector
)

Converts a Unity Vector3 to a device-specific float array without applying any transformation settings.

Parameters:

  • vector The Unity Vector3 to convert.

Return: A float array representing the raw values [x, y, z] from the Vector3.

function FromUnityToDeviceRaw

static float[] FromUnityToDeviceRaw(
Quaternion quat
)

Converts a Unity Quaternion to a device-specific float array without applying any transformation settings.

Parameters:

  • quat The Unity Quaternion to convert.

Return: A float array representing the raw values [w, x, y, z] from the Quaternion.

function FromDeviceToUnityVector3

Vector3 FromDeviceToUnityVector3(
float[] floats
)

Creates a Unity Vector3 from a specified float array using the PositionSettings to apply negations, adjust the axis order, and then add an offset.

Parameters:

  • floats A float array containing three elements [x, y, z].

Return: A Vector3 adjusted according to the PositionSettings.

The modifications are applied in the same order as described, contrasting the inverse order used in the FromUnityToDevice method.

function FromDeviceToUnityQuaternion

Quaternion FromDeviceToUnityQuaternion(
float[] floats
)

Creates a Unity Quaternion from a given float array using the RotationSettings.

Parameters:

  • floats A float array containing four elements [w, x, y, z].

Return: A Quaternion adjusted according to the RotationSettings.

This method applies negations to the quaternion components, reorders them based on the specified axis order, and then applies a rotation offset.

function FromUnityToDevice

float[] FromUnityToDevice(
Vector3 vector
)

Converts a Unity Vector3 back to a device-specific float array using the PositionSettings.

Parameters:

  • vector The Unity Vector3 to convert back to device coordinates.

Return: A float array containing three elements [x, y, z] representing the device coordinates derived from the Vector3 according to the PositionSettings.

This method first subtracts the position offset, then reverses the axis order, and finally applies negations.

The transformations are applied in the reverse order compared to those in the FromDeviceToUnityVector3 method.

function FromUnityToDevice

float[] FromUnityToDevice(
Quaternion vector
)

Converts a Unity Quaternion back to a device-specific float array using the RotationSettings.

Parameters:

  • vector The Unity Quaternion to convert back to device coordinates.

Return: A float array containing four elements [w, x, y, z] representing the device coordinates derived from the Vector3 according to the PositionSettings.

This method first inverse the rotation offset, then reverses the axis order, and finally applies negations.

The transformations are applied in the reverse order compared to those in the FromDeviceToUnityQuaternion method.

function Clone

object Clone()

Public Property Documentation

property PositionSettings

Vector3Settings PositionSettings;

property RotationSettings

QuaternionSettings RotationSettings;