/******************************************************************************\ * Copyright (C) Leap Motion, Inc. 2011-2014. * * Leap Motion proprietary. Licensed under Apache 2.0 * * Available at http://www.apache.org/licenses/LICENSE-2.0.html * \******************************************************************************/ using UnityEngine; using System.Collections; using Leap; namespace Leap { public static class Utils { public static void IgnoreCollisions(GameObject first, GameObject second, bool ignore = true) { if (first == null || second == null) return; Collider[] first_colliders = first.GetComponentsInChildren(); Collider[] second_colliders = second.GetComponentsInChildren(); for (int i = 0; i < first_colliders.Length; ++i) { for (int j = 0; j < second_colliders.Length; ++j) { if (first_colliders[i] != second_colliders[j] && first_colliders[i].enabled && second_colliders[j].enabled) { Physics.IgnoreCollision(first_colliders[i], second_colliders[j], ignore); } } } } } }