# LeapUnityExtensions¶

class Leap::UnityVectorExtension

Extends the Leap Motion Vector class to converting points and directions from the Leap Motion coordinate system into the Unity coordinate system.

Public Members

const float INPUT_SCALE

Scale factor from Leap units (millimeters) to Unity units (meters).

Public Static Functions

Vector3 ToUnity(this Vector leap_vector, bool mirror = false)

Converts a direction vector from Leap to Unity.

(Does not scale.)

Changes from the Leap Motion right-hand coordinate convention to the Unity left-handed convention by negating the z-coordinate.

Parameters
• mirror -

If true, the vector is reflected along the z axis.

• leap_vector -

the Leap.Vector object to convert.

Vector3 ToUnityScaled(this Vector leap_vector, bool mirror = false)

Converts a point from Leap to Unity.

(Scales.)

Changes from the Leap Motion right-hand coordinate convention to the Unity left-handed convention by negating the z-coordinate. Also scales from Leap Motion millimeter units to Unity meter units by multiplying the vector by .001.

Parameters
• mirror -

If true, the vector is reflected along the z axis.

• leap_vector -

the Leap.Vector object to convert.

Public Static Attributes

Constant used when converting from right-handed to left-handed axes.

class Leap::UnityMatrixExtension

Extends the Leap Mition Matrix class to convert Leap Matrix objects to to Unity Quaternion rotations and translations.

Public Static Functions

Quaternion Rotation(this Matrix matrix, bool mirror = false)

Converts a Leap Matrix object representing a rotation to a Unity Quaternion.

Parameters
• matrix -

The Leap.Matrix to convert.

• mirror -

If true, the operation is reflected along the z axis.

Vector3 Translation(this Matrix matrix, bool mirror = false)

Converts a Leap Matrix object representing a translation to a Unity Vector3 object.

Parameters
• matrix -

The Leap.Matrix to convert.

• mirror -

If true, the operation is reflected along the z axis.

Public Static Attributes