Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void Awake()
        {
            //
            if (avatar == null)
            {
                return;
            }

            //
            Transform t = transform;

            avatar = avatar.Instantiate(t);          // ???
            avatar.MapToJoints(t, ref m_Joints, ref joints);

            //
            hands = new HandControllerBase[2];
            hands[HandControllerBase.k_LeftHand]  = new HandControllerBase(this, HandControllerBase.k_LeftHand, HandBones.LeftHand);
            hands[HandControllerBase.k_RightHand] = new HandControllerBase(this, HandControllerBase.k_RightHand, HandBones.RightHand);

            //
            fingers = new Dictionary <HandBones, HandFinger>();
            HandBones b; HandFinger f;

            for (int i = 0, imax = 5; i < imax; ++i)
            {
                //
                b = HandBones.LeftThumbProximal + 3 * i;
                fingers.Add(b, f = new HandFinger(this, i, b));
                hands[HandControllerBase.k_LeftHand].AddFinger(f);
                //
                b = HandBones.RightThumbProximal + 3 * i;
                fingers.Add(b, f = new HandFinger(this, i, b));
                hands[HandControllerBase.k_RightHand].AddFinger(f);
            }
            //
            if (m_LeftGesture != null)
            {
                hands[HandControllerBase.k_LeftHand].SetGesture(m_LeftGesture);
            }
            if (m_RightGesture != null)
            {
                hands[HandControllerBase.k_RightHand].SetGesture(m_RightGesture);
            }
            // Clean up...
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 public virtual void AddFinger(HandFinger o_finger)
 {
     o_finger.hand = this;
     fingers[o_finger.fingerId] = o_finger;
     //Log.i("HandControllerBase",(HandBones.Thumb+(o_finger.joints[0].boneId-handId-1)/3).ToString());
 }