Exemple #1
0
        //----------------------------------------------------------------------------------------------
        // Monobehaviour

        protected override void Awake()
        {
            base.Awake();
            SG_Util.CheckForHandInfo(this.transform, ref this.handModel);
            if (this.handModel != null)
            {
                if (palmTouch != null && !palmTouch.HasTarget)
                {
                    this.palmTouch.SetTrackingTarget(handModel.wristTransform, true);
                }

                Transform target;
                if (thumbTouch != null && !thumbTouch.HasTarget && handModel.GetFingerTip(SG_HandSection.Thumb, out target))
                {
                    this.thumbTouch.SetTrackingTarget(target, true);
                }
                if (indexTouch != null && !indexTouch.HasTarget && handModel.GetFingerTip(SG_HandSection.Index, out target))
                {
                    this.indexTouch.SetTrackingTarget(target, true);
                }
                if (middleTouch != null && !middleTouch.HasTarget && handModel.GetFingerTip(SG_HandSection.Middle, out target))
                {
                    this.middleTouch.SetTrackingTarget(target, true);
                }
            }
        }
Exemple #2
0
 /// <summary> Sets up this script's components to link to the same glove and the appropriate hand section. </summary>
 public void SetupScripts()
 {
     if (fingerFeedbackScripts.Length < 5)
     {
         Debug.LogWarning(this.name + " has only " + fingerFeedbackScripts.Length + "/5 finger scripts connected," +
                          " and will not provide feedback to all fingers.");
     }
     for (int f = 0; f < fingerFeedbackScripts.Length && f < 5; f++)
     {
         fingerFeedbackScripts[f].linkedGlove    = this.gloveHardware;
         fingerFeedbackScripts[f].feedbackScript = this;
         fingerFeedbackScripts[f].handLocation   = (SG_HandSection)f;
         if (handModel != null)
         {
             Transform target;
             if (handModel.GetFingerTip(fingerFeedbackScripts[f].handLocation, out target))
             {
                 fingerFeedbackScripts[f].SetTrackingTarget(target, true);
             }
         }
     }
     if (wristFeedbackScript != null)
     {
         wristFeedbackScript.linkedGlove  = this.gloveHardware;
         wristFeedbackScript.handLocation = SG_HandSection.Wrist;
         if (handModel != null)
         {
             wristFeedbackScript.SetTrackingTarget(handModel.wristTransform, true);
         }
     }
 }