【VR】Leap Motion 官网文档 LeapUnityExtensions (LeapUnity扩展)

前言


Leap Motion Unity部分的API进入最后冲刺阶段,不算派生的小类,本篇是倒数第二篇。
不得不忠谢这合作的力量。


LeapUnityExtensions类提供了从Unity坐标系到Leap坐标系的各种转换功能。

LeapUnityExtensions LeapUnity扩展


class Leap:UnityVectorExtension  Leap类(继承UnityVectorExtension)

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

继承Leap Motion Vector类来将点和方向从LeapMotion坐标系转换到Unity坐标系。


Public Members 公共变量

const float INPUT_SCALE float常量 输入缩放比例

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

从Leap(单位:毫米)到Unity(单位:米)的缩放系数。


Public Static Functions 全局静态方法 


Vector3 ToUnity(this Vector leap_vector, bool mirror = false)  转换至Unity模式


Converts a direction vector from Leap to Unity.

将一个方向向量从Leap模式转换到Unity模式。

(Does not scale.) 

(不缩放。)

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

通过忽略Z轴的方式将LeapMotion的右手坐标系变为Unity的左手坐标系。


Parameters 参数

• mirror - If true, the vector is reflected along the z axis. 镜像:如果是true,则向量沿Z轴翻转。

• leap_vector - the Leap.Vector object to convert.  Leap向量: Leap向量的对象转换。


Vector3 ToUnityScaled(this Vector leap_vector, bool mirror = false) 转换至Unity模式并进行缩放


Converts a point from Leap to Unity.

将一个点从Leap模式转换至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.

通过忽略Z轴的方式将LeapMotion的右手坐标系变为Unity的左手坐标系。通过向量乘0.001的方式将LeapMotion的毫米单位转换为Unity的米单位。


Parameters 参数

• mirror - If true, the vector is reflected along the z axis.镜像:如果是true,则向量沿Z轴翻转。

• leap_vector - the Leap.Vector object to convert.Leap向量: Leap向量的对象转换。



Public Static Attributes 全局静态属性

readonly Vector3 Z_FLIP  Vector3 只读属性 Z翻转轴

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

从右手转换到左手时不变的轴

class Leap::UnityMatrixExtension Leap类(继承UnityMatrixExtension)

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

继承Leap Mition Matrix类将Leap矩阵对象装换成Unity四元数旋转和位移。


Public Static Functions 全局静态方法


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


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

将一个代表角度的Leap矩阵对象转换成Unity四元数。


Parameters 参数

• matrix - The Leap.Matrix to convert. 矩阵:Leap矩阵转换

• mirror - If true, the operation is reflected along the z axis.镜像:如果是true,则向量沿Z轴翻转。


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


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

将一个代表位移的Leap矩阵对象转换成Unity向量对象。

Parameters 参数

• matrix - The Leap.Matrix to convert.矩阵:Leap矩阵转换

• mirror - If true, the operation is reflected along the z axis.镜像:如果是true,则向量沿Z轴翻转。


Public Static Attributes 全局静态属性

readonly Vector LEAP_FORWARD 只读属性 Vector Leap前方

Forward in the Leap coordinate system.

在Leap坐标系中的前方。


readonly Vector LEAP_ORIGIN 只读属性 Vector Leap原点

The origin point in the Leap coordinate system.

在Leap坐标系中的原点。


readonly Vector LEAP_UP 只读属性 Vector Leap上方

Up in the Leap coordinate system.

在Leap坐标系中的上方。


————————————————————————————————————————————


更多参考:

【VR】Leap Motion 官网文档 脚本参考(目录)


(版权声明:本篇为Leap Motion 官网文档译文,版权归Leap Motion 官网所有,图文内容仅供学习使用。)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值