前言:

本系列译文是为迎合Unity VR的热潮与大家的学习需要,推出的针对Unity方向的Leap Motion官方文档中英对照翻译。

本篇为第六篇 《HandModel(手部模型)》 ,该类主要用于连接控制器和手部模型,以及处理手臂、肘部、手掌、手指的位置和角度等信息。

Handmodel is the base class for all the other hand scripts. If you are creating your own hands and need a custom hand script to go with them, extend HandModel and implement the Init() and Update() methods. You may need to extend the FingerModel class, too.

手部模型是其它手部脚本的基础类。如果你想创建自己的手并需要一个自定义的手部脚本添加在上面,那么就需要继承HandModel类并实现它的Init( ) 和 Update( ) 方法。同时你还需要扩展FingerModel(手指模型)类。

class HandModel  手部模型类

The base class for all hand models, both graphics and physics.

所有手部模型的基类,包括图形的和物理的。

This class serves as the interface between the HandController object and the concrete hand object containing the graphics and physics of a hand.

该类是HandController(手部控制器)对象和包含了图形及物理手模型的实体手的接口。

Subclasses of HandModel must implement InitHand() and UpdateHand(). The UpdateHand() function is called in the Unity Update() phase for graphics HandModel instances; and in the Unity FixedUpdate() phase for physics objects.InitHand() is called once, when the hand is created and is followed by a call to UpdateHand().

HandModel类的子类必须实现InitHand() 和 UpdateHand()。 UpdateHand() 函数在Unity脚本的Update() 方法阶段被调用时,用于图形 HandModel的实例;而在Unity脚本的FixedUpdate()阶段调用时用于物理对象。InitHand() 只在手部创建后被调用一次,之后UpdateHand()被调用。

Public Functions   公共函数

Vector3 GetArmCenter()   获取手臂中心

Calculates the center of the forearm relative to the controller.
计算前臂相对于控制器的中心。

Return  返回值
A Vector3 containing the Unity coordinates of the center of the forearm.
前臂中心点的Unity坐标,为Vector3类型。
Vector3 GetArmDirection()  获取手臂方向

Calculates the direction vector of the forearm relative to the controller.
计算前臂相对于控制器的方向。

Return   返回值
A Vector3 representing the direction of the forearm (pointing from elbow to wrist).
代表前臂方向的Vector3向量(从肘部指向手腕)。
float GetArmLength()  获取手臂长度

Returns the measured length of the forearm in meters.
返回以米为单位的前臂长度。

Quaternion GetArmRotation()  获取手臂旋转角度

Calculates the rotation of the forearm relative to the controller.
计算前臂相对于控制器的旋转角度。

Return  返回值
A Quaternion representing the rotation of the arm relative to the controller.
手臂相对于控制器的旋转角度,以四元数表示。
float GetArmWidth()  获取手臂宽度

Returns the measured width of the forearm in meters.
以米为单位返回前臂的宽度。

HandController GetController()  获取控制器

The parent HandController object of this hand.
该手部的HandController(手部控制器)父对象。

Vector3 GetElbowPosition()  获取肘部位置

Calculates the position of the elbow relative to the controller.
计算肘部相对于控制器的位置。

Return  返回值
A Vector3 containing the Unity coordinates of the elbow.
肘部的Unity坐标,Vector3类型。
Vector3 GetHandOffset() 获取手部偏移量

Calculates the offset between the wrist position and the controller based on theHandController.handMovementScale property and the Leap hand wrist position.
计算基于HandController.handMovementScale属性的控制器肘部位置和Leap手肘部位置的偏移量。

Hand GetLeapHand() 获取Leap手部

Returns the Leap Hand object represented by this HandModel.
返回一个由当前HandModel(手部模型)表示的Leap手对象。

Note that any physical quantities and directions obtained from the Leap Hand object are relative to the Leap Motion coordinate system, which uses a right-handed axes and units of millimeters.
需要注意的是,从Leap 手部对象获取的物理数量和方向是相对于Leap Motion 坐标系的。该坐标系使用右手坐标系统并以毫米为单位。

Vector3 GetPalmDirection() 获取手掌方向

Calculates the direction vector of the hand relative to the controller.
计算手掌相对于控制器的方向向量。

Return  返回值
A Vector3 representing the direction of the hand relative to the controller.
手掌相对于控制器的方向,Vector3类型。
Vector3 GetPalmNormal() 获取手掌法线

Calculates the normal vector projecting from the hand relative to the controller.
计算手掌相对于控制器的法线向量。

Return  返回值
A Vector3 representing the vector perpendicular to the palm.
垂直于手掌平面的向量,Vector3类型。
Vector3 GetPalmPosition() 获取手掌位置

Calculates the position of the palm relative to the controller.
计算手掌相对于控制器的位置。

Return  返回值
A Vector3 containing the Unity coordinates of the palm position.
手掌位置的Unity坐标,Vector3类型。
Quaternion GetPalmRotation() 获取手掌角度

Calculates the rotation of the hand relative to the controller.
计算手掌相对于控制器的角度。

Return 返回值
A Quaternion representing the rotation of the hand relative to the controller.
手掌相对于控制器的四元数角度,Quaternion类型。
Vector3 GetWristPosition()  获取肘部位置

Calculates the position of the wrist relative to the controller.
计算肘部相对于控制器的位置。

Return  返回值
A Vector3 containing the Unity coordinates of the wrist.
肘部的Unity坐标,Vector3类型。
void InitHand() 初始化手部 【译者注:重要】

Implement this function to initialise this hand after it is created.
实现该函数,在手部被创建后进行初始化。

This function is called by the HandController during the Unity Update() phase when a new hand is detected by the Leap Motion device.
当Leap Motion 设备检测到一个新的手时,该函数就会在Unity脚本的Update()阶段被HandController调用。

bool IsMirrored()  是否是镜像的

Whether this hand is currently mirrored.
当前的手是否是镜像的。

void MirrorZAxis(bool mirror = true)   镜像Z轴

Sets the mirror z-axis flag for this Hand Model and its fingers.
为该手部模型及其手指设置镜像Z轴标识。

Mirroring the z axis reverses the hand so that they face the opposite direction as if in a mirror.
以Z轴翻转手部产生镜像,使其方向相对,就像在镜子里一样。

Parameters 参数
  • mirror -

    Set true, the default value to mirror; false for normal rendering.
    镜像 - 默认为真,产生镜像;为加时正常渲染。

void SetController(HandController controller)  设置控制器

Sets the parent HandController object.
设置手部控制器父对象。

void SetLeapHand(Hand hand)  设置Leap手部

Assigns a Leap Hand object to this hand model.
给当前手模型设置一个Leap手部。

Note that the Leap Hand objects are recreated every frame. The parent HandController calls this method to set or update the underlying hand.
需要注意的是,Leap手部每一帧都会被重新创建。父对象HandController调用该方法用于设置和更新原本的手部。

abstract void UpdateHand() 更新手部 【译者注:重要】

Implement this function to update this hand once every game loop.
实现该函数,用于在每次游戏循环中更新一次手部。

For HandModel instances assigned to the HandController graphics hand list, the HandController calls this function during the Unity Update() phase. For HandModel instances in the physics hand list, theHandController calls this function in the FixedUpdate() phase.
对于HandController图形手部列表中的HandModel实例,HandController将在Unity脚本的Update() 阶段调用该方法。
对于HandController图形物理列表中的HandModel实例,HandController将在Unity脚本的FixedUpdate() 阶段调用该方法。




Public Members  公共成员

FingerModel [] fingers  手指模型

The array of finger objects for this hand.
该手部的手指对象数组。

The array is ordered from thumb (element 0) to pinky (element 4).
该数组顺序是从大拇指(下标为0)到小手指(下标为0)。

float handModelPalmWidth 手掌模型宽度

The model width of the hand in meters.
以米为单位衡量手掌模型宽度。

This value is used with the measured value of the user’s hand to scale the model proportionally.
该值和用户手部测量值一起,用于恰当的缩放模型。

const int NUM_FINGERS 手指数量

The number of fingers on a hand.
一个手上的手指数量。

DebugHand  调试手型

The DebugHand draws no graphics in a Game view, but draws lines for the parts of the hand in the Scene view. Use the DebugHand when you do not want visible hands, but want to see where the hands are in the Scene view.
调试手型不会在Game(游戏)试图中绘制任何徒刑,但会用线型将手的各个部分绘制在Scene(场景)视图中。调试手型一般用于不希望看到手型,但想在Scene(场景)视图中看到的情形。

class DebugHand  调试手型类

A HandModel that draws lines for the bones in the hand and its fingers. 
绘制手部和手指骨骼线条的手部模型。

The debugs lines are only drawn in the Editor Scene view (when a hand is tracked) and not in the Game view. Use debug hands when you aren’t using visible hands in a scene so that you can see where the hands are in the scene view. 
调试线条仅在编辑场景视图中(当手型被追踪到时)显示,而游戏视图中并不显示。当你在游戏场景中不想使用可见手型但希望确认其在场景视图中位置时,使用调试手型。

Public Functions  公共函数

override void InitHand()  初始化手型

Initializes the hand and calls the line drawing function. 
初始化手型,并调用线条绘制函数。

override void UpdateHand() 更新手型

Updates the hand and calls the line drawing function.
更新手型,并调用线条绘制函数。

PolyHand  多边形手型

The PolyHand script is used in the PolyHand prefabs.
PolyHand脚本用于多表型手型预设体中。

Polyhand 1  多边形手型1

PolyHand 2  多边形手型2

PolyHand 3  多边形手型3

class PolyHand  多边形手型类

A deforming, very low poly count hand. 
变形的低模手型。

All the graphics for this hand are drawn by the fingers. There is no representation for the palm or the arm. 
该手型的所有图形是以手指为单位绘制的。没有代表手掌或手臂的部分。

Public Functions  公共函数

override void InitHand()  初始化手型

Initializes the hand and calls the finger initializers. 
初始化手型并调用所有手指初始化函数。

override void UpdateHand()  更新手型

Updates the hand and calls the finger update functions.
更新手型并调用手指更新函数。

RiggedHand  骨骼绑定手型

The RiggedHand script is used with the human-like hand prefabs as well as the image hand prefab. It updates the hand pose by changing the orientations of the bones in a graphics model. The model itself is rotated and positioned based on the palm position.
RiggedHand脚本用于人的拟真手型预设体和图形手型预设体。该手型是通过改变图形模型中的骨骼方向角度来更新手型姿势的。该模型基于首长位置旋转和定位。

ImageFullHand 完整图像手型

PepperDarkCutHand  暗肤色手型

SaltLightHand  浅肤色手型

SaltMediumFullHand 中等肤色手型

class RiggedHand  骨骼绑定手型类
Public Functions 公共函数

override void InitHand() 初始化手型

Implement this function to initialise this hand after it is created. 
实现该函数,用于在创建手型后对其进行初始化。

This function is called by the HandController during the Unity Update() phase when a new hand is detected by the Leap Motion device. 
当手型被Leap Motion设备检测到时,HandController(手部控制器)就会在Unity的Update方法中调用该函数。

override void UpdateHand() 更新手型

Implement this function to update this hand once every game loop. 
实现该函数,用于在每一次游戏循环中更新手型。

For HandModel instances assigned to the HandController graphics hand list, the HandController calls this function during the Unity Update() phase. For HandModel instances in the physics hand list, the HandController calls this function in the FixedUpdate() phase.
如果HandModel(手部模型)实例赋值在HandController(手部控制器)的图形手型列表中,HandController(手部控制器)便会在Unity的Update方法中调用该函数。如果赋值在物理手型列表中,则会在FixedUpdate方法中调用。

RigidHand (Physics)  刚体手型(物理)

The RigidHand script initializes and updates Unity RigidBody and BoxCollider objects for the palm and fingers (and, optionally, the forearm and wrist). RigidHand is used with RigidFinger to allow the prefab hands to interact with other Unity objects using collisions.
RigidHand脚本用于初始化和更新 Unity中手掌和手指(前臂与腕关节可选)对象上的刚体和盒子碰撞器。刚体手型与刚体手指共同使用,用于控制手部预设体与Unity中的其他对象进行碰撞交互。

The RigidHand and ThickRigidHand prefabs differ primarily in the thickness of the palm. The RigidFullHand prefab includes a RigidBody and BoxCollider for the forearm.

class RigidHand
Public Functions

override void InitHand()

Implement this function to initialise this hand after it is created.

This function is called by the HandController during the Unity Update() phase when a new hand is detected by the Leap Motion device.

override void UpdateHand()

Implement this function to update this hand once every game loop.

For HandModel instances assigned to the HandController graphics hand list, the HandController calls this function during the Unity Update() phase. For HandModel instances in the physics hand list, the HandController calls this function in the FixedUpdate() phase.

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

更多参考:

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

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

【VR】Leap Motion 官网文档 HandModel(手部模型)相关推荐

  1. redis过期机制(官网文档总结)

    官网地址:https://redis.io/commands/expire redis过期定义如下: Set a timeout on key. After the timeout has expir ...

  2. mybatis官网文档mybatis_doc

    在平时的学习中,我们可以去参考官网的文档来学习,这个文档有中文的,方便我们去阅读,而且这里的分类很详细. 官网文档链接:http://www.mybatis.org/mybatis-3/zh/inde ...

  3. vue-awesome-swiper官网文档

    vue-awesome-swiper官网文档 https://www.swiper.com.cn/api/index.html

  4. AFNetworking官网文档及翻译

    AFNetworking2.4.1解析 1.官网文档外加点中文注释 AFNetworking官网(点击进入) AFNetworking翻译注释 Architecture(结构) NSURLConnec ...

  5. SAP ME架构官网文档学习总结

    认证平台 SAP ME PAM(Platform Availability Matrix ) 安装的应用以及相应的数据库均可在官网上进行查看https://support.sap.com/pam 最低 ...

  6. Go语言从入门到规范-1.1、Go语言官网文档大纲及环境搭建

    Go语言从入门到规范-1.1.Go语言官网文档大纲及环境搭建 文章目录 Go语言从入门到规范-1.1.Go语言官网文档大纲及环境搭建 前言 一.go简介及学习路径 二.安装go 1.下载Go发行版 2 ...

  7. B2G OS官网文档梳理

    前提: B2G OS官方文档地址:https://developer.mozilla.org/en-US/docs/Archive/B2G_OS 在网上查阅关于FireFox OS相关的文章.博客,发 ...

  8. 根据官网文档看Spark Streaming对接Kafka的两种方式, 以及如何实现Exactly Once语义

    注: 本文算是本人的学习记录, 中间可能有些知识点并不成熟, 不能保证正确性. 只能算是对官网文档作了个翻译和解读, 随时有可能回来更新和纠错 上一篇文章讨论了Spark Streaming的WAL( ...

  9. Spring Security 官网文档学习

    文章目录 通过`maven`向普通的`WEB`项目中引入`spring security` 配置 `spring security` `configure(HttpSecurity)` 方法 自定义U ...

最新文章

  1. 虚拟化如何做实?详解戴尔2.0版解决方案
  2. 4.7地铁查询开发进度
  3. Golang的导包和引用包的问题
  4. [转] sql server 跨数据库调用存储过程
  5. Android 语音播报,语音识别demo
  6. C++随机数(rand和srand)函数用法详解
  7. css字体及css文本控制
  8. 前端的ajax缓存,解析jquery中的ajax缓存问题
  9. JWT(JSON Web Token) 多网站的单点登录,放弃session 转载https://www.cnblogs.com/lexiaofei/p/7409846.html...
  10. VMware Vsphere 6.0安装部署 总体部署架构
  11. 系统开机 linux 时间不对,linux下查看系统运行时间和最近一次的开机启动时间
  12. vue项目,路由跳转页面后滚动条自动回到顶部
  13. Debian9.5安装VNC并且配置vnc开机自启动
  14. matplotlib之简单动画制作
  15. ITween操作API
  16. 计算机英语单词怎么读,英语单词read怎么读,read的音标是什么,read是什么意思 - 音标网...
  17. 2015校园招聘联通笔试的几个题目
  18. 赛后总结2018-08-25
  19. C语言关于输入某天日期求是本年第几天(计算天数)
  20. 清默网络——RIP单播更新

热门文章

  1. 云计算的三种服务模式是什么?
  2. aide怎么导入一些java文件_aide java项目导入jar
  3. 《淘宝网》之系统质量属性分析
  4. 第5章:文件类工具软件
  5. 论文投稿指南——中文核心期刊推荐(建筑科学)
  6. Python中 os.popen、os.system和subprocess.popen方法介绍
  7. photoshop输出html网页方法
  8. Java基础系列(十四)常用API
  9. 智慧商贸之结算账户模块的新增
  10. 网络时间的那些事及 ntpq 详解