日韩在线国产精品_少妇性饥渴BBBBB搡BBBB_3344在线永久观看视频播放_亚洲精品一区二区三区新线路_亚洲精品一级片_182午夜免费

  • wiseglove數(shù)據(jù)手套驅(qū)動(dòng)unity3D游戲角色右手模型關(guān)節(jié)

    2017/2/20??????點(diǎn)擊:

    目前unity3D游戲引擎已經(jīng)廣泛的用于游戲開發(fā),而且unity3d在國(guó)內(nèi)發(fā)展比較迅速,已經(jīng)成為了主流的游戲開發(fā)引擎之一。隨著越來越多的開發(fā)人員開始使用unity3D,網(wǎng)絡(luò)上unity3D的中文學(xué)習(xí)資料也逐漸豐富。為了方便客戶使用wiseglove數(shù)據(jù)手套,我們專門組織編寫了在Unity3D環(huán)境下調(diào)用wiseglove數(shù)據(jù)手套SDK開發(fā)包,用數(shù)據(jù)手套的實(shí)時(shí)數(shù)據(jù)來驅(qū)動(dòng)unity3d中的角色右手模型的demo程序。

    Unity3D的新版動(dòng)畫系統(tǒng)Mecanim已經(jīng)對(duì)人類類型的角色支援設(shè)計(jì)了一套殊的工作流程。用戶將3dsmax或者maya中導(dǎo)入的人形角色導(dǎo)入unity3d后,需要為角色創(chuàng)建Avatar,本質(zhì)上就是分析導(dǎo)入資源的骨骼結(jié)構(gòu),并對(duì)其進(jìn)行標(biāo)識(shí),從而轉(zhuǎn)化成Mecanim可以識(shí)別的骨骼結(jié)構(gòu),或者說轉(zhuǎn)化成通用的骨骼結(jié)構(gòu),這也是為什么在資源準(zhǔn)備時(shí)在骨骼的創(chuàng)建及命名要遵循一定的規(guī)范的原因,這樣方便mecanim對(duì)骨骼的識(shí)別。

    在導(dǎo)入的資源都具有通用的骨骼結(jié)構(gòu)時(shí),就可以實(shí)現(xiàn)動(dòng)畫的共用。

    在這里我們用wiseGlove數(shù)據(jù)手套驅(qū)動(dòng)右手模型時(shí)也使用了unity標(biāo)準(zhǔn)的avatar映射的人手關(guān)節(jié)模型,這樣方便我們對(duì)不同的角色的右手模型進(jìn)行驅(qū)動(dòng)。

    下面是用于驅(qū)動(dòng)人手模型的代碼,需要將這段代碼掛載在場(chǎng)景中的角色身上:

     

    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.


        //將從數(shù)據(jù)手套獲取到的各個(gè)手指關(guān)節(jié)的Rotation賦值給下面對(duì)應(yīng)的Quaternion類型的公用變量,

        //就可以實(shí)現(xiàn)手指關(guān)節(jié)的運(yùn)動(dòng)

        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組件獲取右手手指的各個(gè)關(guān)節(jié)

            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 () {

            //將從數(shù)據(jù)手套獲取到的旋轉(zhuǎn)量賦值給相應(yīng)的手指關(guān)節(jié)的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;


        }

    }

     

    主站蜘蛛池模板: 国产亚洲精品AA片在线不卡 | 色97在线 | 有码丝袜久久久 | 丰满少妇又爽又紧又丰满在线观看 | 国产69精品久久99不卡免费版 | 成人深夜www视频免费软件 | 国产高潮流白浆免费观看 | 亚洲精品成人久久久 | 国产黄色视频白丝 | 国产在线可以看麻豆 | 一级黄色片aaa | 精品久久中文字幕 | 日本丁香久久综合国产精品 | 一级在线免费视频 | 国产黄片自拍亚洲AV | 99播在线视频精品 | 久久最新精品视频 | 99久久精品无码一区二区毛片免费 | 五月婷婷亚洲综合视频 | 亚日韩在线 | 国产色视频免费 | 亚洲精品久久久久久久久久久久久 | 久久国产欧美一区二区三区免费 | 欧美日韩精品视频一区二区在 | 女的被弄到高潮娇喘喷水视频 | 深夜A级毛片视频免费 | 亚洲国产日韩在线观看 | 日韩视频免费在线播放 | 久一区二区三区 | 亚洲精品乱码久久久久久高潮 | 精品欧美一区二区三区精品久久 | 国产网红福利视频一区二区 | 国产成人毛片精品不卡在线 | 91福利国产在线播放午夜 | 亚洲小视频在线观看 | 国产乱淫av片免费看 | 777午夜精品免费观看 | 中文字幕在线视频播放 | 久久99精品视频一区97 | 91精品国产自产91精品 | 亚洲国产精品久久久久久久 |