樱花草在线播放免费高清观看,国产成人久久综合777777麻豆,啦啦啦在线视频免费观看正在播放1,在线天堂√中文,亚洲色大成网站www永久男同,国产丰满乱子伦无码专区,日韩精品 在线 国产 丝袜 ,三级在线看中文字幕完整版
  • 您的位置:首頁 > 新聞動態 > 技術文章

    wiseglove數據手套驅動unity3D游戲角色右手模型關節

    2017/2/20??????點擊:

    目前unity3D游戲引擎已經廣泛的用于游戲開發,而且unity3d在國內發展比較迅速,已經成為了主流的游戲開發引擎之一。隨著越來越多的開發人員開始使用unity3D,網絡上unity3D的中文學習資料也逐漸豐富。為了方便客戶使用wiseglove數據手套,我們專門組織編寫了在Unity3D環境下調用wiseglove數據手套SDK開發包,用數據手套的實時數據來驅動unity3d中的角色右手模型的demo程序。

    Unity3D的新版動畫系統Mecanim已經對人類類型的角色支援設計了一套殊的工作流程。用戶將3dsmax或者maya中導入的人形角色導入unity3d后,需要為角色創建Avatar,本質上就是分析導入資源的骨骼結構,并對其進行標識,從而轉化成Mecanim可以識別的骨骼結構,或者說轉化成通用的骨骼結構,這也是為什么在資源準備時在骨骼的創建及命名要遵循一定的規范的原因,這樣方便mecanim對骨骼的識別。

    在導入的資源都具有通用的骨骼結構時,就可以實現動畫的共用。

    在這里我們用wiseGlove數據手套驅動右手模型時也使用了unity標準的avatar映射的人手關節模型,這樣方便我們對不同的角色的右手模型進行驅動。

    下面是用于驅動人手模型的代碼,需要將這段代碼掛載在場景中的角色身上:

     

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;


    public class RightHand : MonoBehaviour {

        Animator animator;

        Transform rightThumbProximal; //This is the right thumb 1st phalange.

        Transform rightThumbIntermediate; // This is the right thumb 2nd phalange.

        Transform rightThumbDistal;    //This is the right thumb 3rd phalange.

        Transform rightIndexProximal; // This is the right index 1st phalange.

        Transform rightIndexIntermediate; // This is the right index 2nd phalange.

        Transform rightIndexDistal; // This is the right index 3rd phalange.

        Transform rightMiddleProximal; // This is the right middle 1st phalange.

        Transform rightMiddleIntermediate;// This is the right middle 2nd phalange.

        Transform rightMiddleDistal;// This is the right middle 3rd phalange.

        Transform rightRingProximal;// This is the right ring 1st phalange.

        Transform rightRingIntermediate;// This is the right ring 2nd phalange.

        Transform rightRingDistal;// This is the right ring 3rd phalange.

        Transform rightLittleProximal;// This is the right little 1st phalange.

        Transform rightLittleIntermediate;// This is the right little 2nd phalange.

        Transform rightLittleDistal;// This is the right little 3rd phalange.


        //將從數據手套獲取到的各個手指關節的Rotation賦值給下面對應的Quaternion類型的公用變量,

        //就可以實現手指關節的運動

        public Quaternion R_Thumb_P_rotation; //R-right,T-Thumb,P-Proximal

        public Quaternion R_Thumb_I_rotation;

        public Quaternion R_Thumb_D_roatation;

        public Quaternion R_Index_P_rotation; //R-right,I-Index,P-Proximal

        public Quaternion R_Index_I_rotation;

        public Quaternion R_Index_D_roatation;

        public Quaternion R_Middle_P_rotation; //R-right,M-Middle,P-Proximal

        public Quaternion R_Middle_I_rotation;

        public Quaternion R_Middle_D_roatation;

        public Quaternion R_Ring_P_rotation; //R-right,R-Ring,P-Proximal

        public Quaternion R_Ring_I_rotation;

        public Quaternion R_Ring_D_roatation;

        public Quaternion R_Little_P_rotation; //R-right,L-Little,P-Proximal

        public Quaternion R_Little_I_rotation;

        public Quaternion R_Little_D_roatation;


        // Use this for initialization

        void Start () {

            //獲取角色的Animator組件

            animator = transform.GetComponent();

            //通過Animator組件獲取右手手指的各個關節

            rightThumbProximal = animator.GetBoneTransform(HumanBodyBones.RightThumbProximal); 

            rightThumbIntermediate = animator.GetBoneTransform(HumanBodyBones.RightThumbIntermediate);

            rightThumbDistal = animator.GetBoneTransform(HumanBodyBones.RightThumbDistal);

            rightIndexProximal = animator.GetBoneTransform(HumanBodyBones.RightIndexProximal);

            rightIndexIntermediate = animator.GetBoneTransform(HumanBodyBones.RightIndexIntermediate);

            rightIndexDistal = animator.GetBoneTransform(HumanBodyBones.RightIndexDistal);

            rightMiddleProximal = animator.GetBoneTransform(HumanBodyBones.RightMiddleProximal);

            rightMiddleIntermediate = animator.GetBoneTransform(HumanBodyBones.RightMiddleIntermediate);

            rightMiddleDistal = animator.GetBoneTransform(HumanBodyBones.RightMiddleDistal);

            rightRingProximal = animator.GetBoneTransform(HumanBodyBones.RightRingProximal);

            rightRingIntermediate = animator.GetBoneTransform(HumanBodyBones.RightRingIntermediate);

            rightRingDistal = animator.GetBoneTransform(HumanBodyBones.RightRingDistal);

            rightLittleProximal = animator.GetBoneTransform(HumanBodyBones.RightLittleProximal);

            rightLittleIntermediate = animator.GetBoneTransform(HumanBodyBones.RightLittleIntermediate);

            rightLittleDistal = animator.GetBoneTransform(HumanBodyBones.RightLittleDistal);

        }


        // Update is called once per frame

        void Update () {

            //將從數據手套獲取到的旋轉量賦值給相應的手指關節的localRotaion就可以了

            rightThumbProximal.localRotation= R_Thumb_P_rotation;

            rightThumbIntermediate.localRotation = R_Thumb_I_rotation;

            rightThumbDistal.localRotation = R_Thumb_D_roatation;

            rightIndexProximal.localRotation = R_Index_P_rotation;

            rightIndexIntermediate.localRotation = R_Index_I_rotation;

            rightIndexDistal.localRotation = R_Index_D_roatation;

            rightMiddleProximal.localRotation = R_Middle_P_rotation;

            rightMiddleIntermediate.localRotation = R_Middle_I_rotation;

            rightMiddleDistal.localRotation = R_Middle_D_roatation;

            rightRingProximal.localRotation = R_Ring_P_rotation;

            rightRingIntermediate.localRotation = R_Ring_I_rotation;

            rightRingDistal.localRotation = R_Ring_D_roatation;

            rightLittleProximal.localRotation = R_Little_P_rotation;

            rightLittleIntermediate.localRotation = R_Little_I_rotation;

            rightLittleDistal.localRotation = R_Little_D_roatation;


        }

    }

     

    主站蜘蛛池模板: 精产国品一二三产区别手机| 欧美国产成人精品一区二区三区| 成全我在线观看免费第二季| 欲色天天网综合久久| 日本aaaaa片特黄aaaa| 入禽太深日本免费观看| 久久久久亚洲av成人片乱码| 99热久久这里只有精品| 内射少妇一区27p| 国产97在线 | 免费| 国产欧美日韩a片免费软件| 久久精品国产亚洲av电影网| 欧美精产国品一二三产品价格 | 乱人伦中文视频在线| 久久99国产综合精品免费| 青青草视频免费观看| 丰满少妇大力进入av亚洲| 涩涩涩丁香色婷五月网| 国产精品视频露脸| 成人精品视频一区二区| 综合一区无套内射中文字幕| 神马午夜| 亚洲va无码va在线va天堂| 日韩精品真人荷官无码| 内射人妻骚骚骚| 免费免费啪视频观看视频| 青草视频在线观看| av天堂午夜精品一区| 性欧美长视频免费观看不卡| 在线 | 一区二区三区四区| 欧美性xxxxx极品| 蜜臀av片| 国产农村老太xxxxhdxx| 星空影院电影在线看| 成人欧美日韩一区二区三区| 神马午夜电影| 俄罗斯性孕妇孕交| 亚洲av麻豆aⅴ无码电影| 人与禽zozo性伦| 日本猛少妇色xxxxx猛叫| 欧美影院|