示例#1
0
 /// <summary> Set ignoreCollision between this layer and another set of rigidbodies. </summary>
 /// <param name="otherLayer"></param>
 /// <param name="ignoreCollision"></param>
 public void SetIgnoreCollision(SG_HandRigidBodies otherLayer, bool ignoreCollision)
 {
     if (otherLayer != null)
     {
         GameObject wrist = otherLayer.wristObj != null ? otherLayer.wristObj.gameObject : null;
         SetIgnoreCollision(wrist, ignoreCollision);
         for (int f = 0; f < otherLayer.fingerObjs.Length; f++)
         {
             SetIgnoreCollision(otherLayer.fingerObjs[f].gameObject, ignoreCollision);
         }
     }
 }
    /// <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_SenseGloveHardware>();
        }
        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>();
        }

        //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];
                }
            }
        }
    }