Exemple #1
0
 public static void UpdateHand(SG_HandAnimator animater, bool calibrating, SG_HandPose pose)
 {
     if (animater != null && calibrating)
     {
         animater.UpdateHand(pose);
     }
 }
Exemple #2
0
 public static void UpdateOpenClose(bool isRight, SG_HandAnimator animater, bool calibrating, SGCore.Kinematics.HandInterpolator poseInterp, float normalizedTime01)
 {
     if (animater != null && calibrating && poseInterp != null)
     {
         SGCore.Kinematics.Vect3D[][] handAngles = SGCore.Kinematics.Values.FillZero(5, 3);
         for (int f = 0; f < 5; f++)
         {
             if (f == 0)
             {
                 handAngles[f][0].x = poseInterp.CalculateAngle(SGCore.Kinematics.ThumbMovement.T_CMC_Twist, normalizedTime01);
                 handAngles[f][0].z = poseInterp.CalculateAngle(SGCore.Kinematics.ThumbMovement.T_CMC_Abd, normalizedTime01);
                 handAngles[f][0].y = poseInterp.CalculateAngle(SGCore.Kinematics.ThumbMovement.T_CMC_Flex, normalizedTime01);
                 handAngles[f][1].y = poseInterp.CalculateAngle(SGCore.Kinematics.ThumbMovement.T_MCP_Flex, normalizedTime01);
                 handAngles[f][2].y = poseInterp.CalculateAngle(SGCore.Kinematics.ThumbMovement.T_IP_Flex, normalizedTime01);
             }
             else
             {
                 SGCore.Finger finger = (SGCore.Finger)f;
                 handAngles[f][0].z = poseInterp.CalculateAngle(finger, SGCore.Kinematics.FingerMovement.F_MCP_Abd, normalizedTime01);
                 handAngles[f][0].y = poseInterp.CalculateAngle(finger, SGCore.Kinematics.FingerMovement.F_MCP_Flex, normalizedTime01);
                 handAngles[f][1].y = poseInterp.CalculateAngle(finger, SGCore.Kinematics.FingerMovement.F_PIP_Flex, normalizedTime01);
                 handAngles[f][2].y = poseInterp.CalculateAngle(finger, SGCore.Kinematics.FingerMovement.F_DIP_Flex, normalizedTime01);
             }
         }
         animater.UpdateHand(new SG_HandPose(SGCore.HandPose.FromHandAngles(handAngles, isRight)));
     }
 }
Exemple #3
0
        //--------------------------------------------------------------------------------------------------------------------------
        // Monobehaviour

        private void Start()
        {
            // Attempt to retrieve missing references.
            if (this.handAnimation == null && this.touchScript != null && this.touchScript.feedbackScript != null)
            {
                this.handAnimation = this.touchScript.feedbackScript.HandAnimation;
            }
        }
Exemple #4
0
 public static void SetHandExample(SG_HandAnimator animater, bool enabled)
 {
     if (animater != null)
     {
         animater.enabled = false;
         if (animater.handModelInfo != null)
         {
             animater.handModelInfo.gameObject.SetActive(enabled);
         }
     }
 }
Exemple #5
0
        /// <summary> Link relevant scripts to this trackedHand, if they have not been assinged yet. </summary>
        protected void CheckForScripts()
        {
            //if (this.hardware == null) { this.hardware = this.gameObject.GetComponent<SG_HapticGlove>(); }
            if (this.handModel == null)
            {
                this.handModel = this.GetComponentInChildren <SG_HandModelInfo>();
            }

            if (this.grabScript == null)
            {
                this.grabScript = this.GetComponentInChildren <SG_GrabScript>();
            }
            if (this.feedbackScript == null)
            {
                this.feedbackScript = this.GetComponentInChildren <SG_HandFeedback>();
            }
            if (this.handAnimation == null)
            {
                this.handAnimation = this.GetComponentInChildren <SG_HandAnimator>();
            }
            if (this.gestureLayer == null)
            {
                this.gestureLayer = this.GetComponentInChildren <SG_GestureLayer>();
            }
            if (this.statusIndicator == null)
            {
                this.statusIndicator = this.GetComponentInChildren <SG_HandStateIndicator>();
            }

            //Since both RB and PhysicsTrackingLayers have the same component, assing whichever one we haven't done yet.
            if (this.rigidBodyLayer == null || this.physicsTrackingLayer == null)
            {
                SG_HandRigidBodies[] components = this.GetComponentsInChildren <SG_HandRigidBodies>();
                for (int i = 0; i < components.Length; i++)
                {
                    if (this.rigidBodyLayer == null && //we don't yet have a RigidBody Layer
                        (this.physicsTrackingLayer == null || !GameObject.ReferenceEquals(this.physicsTrackingLayer.gameObject, components[i].gameObject)))
                    {
                        rigidBodyLayer = components[i];
                    }
                    if (this.physicsTrackingLayer == null && //we don't yet have a RigidBody Layer
                        (this.rigidBodyLayer == null || !GameObject.ReferenceEquals(this.rigidBodyLayer.gameObject, components[i].gameObject)))
                    {
                        physicsTrackingLayer = components[i];
                    }
                }
            }
        }