/// <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_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]; } } } }
/// <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) { if (this.wristFeedbackScript != null) { otherLayer.SetIgnoreCollision(this.wristFeedbackScript.gameObject, ignoreCollision); } for (int f = 0; f < fingerFeedbackScripts.Length; f++) { if (fingerFeedbackScripts[f] != null) { otherLayer.SetIgnoreCollision(fingerFeedbackScripts[f].gameObject, ignoreCollision); } } } }
/// <summary> Ignore collision between this layer and another. </summary> /// <param name="rigidBodies"></param> /// <param name="ignoreCollisions"></param> public override void SetIgnoreCollision(SG_HandRigidBodies rigidBodies, bool ignoreCollisions) { if (rigidBodies != null) { if (palmTouch != null) { rigidBodies.SetIgnoreCollision(this.palmTouch.gameObject, ignoreCollisions); } if (thumbTouch != null) { rigidBodies.SetIgnoreCollision(this.thumbTouch.gameObject, ignoreCollisions); } if (indexTouch != null) { rigidBodies.SetIgnoreCollision(this.indexTouch.gameObject, ignoreCollisions); } if (middleTouch != null) { rigidBodies.SetIgnoreCollision(this.middleTouch.gameObject, ignoreCollisions); } } }
/// <summary> </summary> /// <param name="rigidBodies"></param> /// <param name="ignoreCollisions"></param> public virtual void SetIgnoreCollision(SG_HandRigidBodies rigidBodies, bool ignoreCollisions) { //does nothing to a default GrabLayer. Only to extensions hereof. }