// We are going to check for collisions from a coarse resolution to a finer grain resolution private bool CollisionCheck(FootstepPlanningState state) { bool isColliding = true; // For every domain we have, we are going to make a collision check, from the coarser to the finer int d = 0; int numberOfDomains = planning.GetNumberOfDomains(); while (isColliding && d < numberOfDomains) { isColliding = planning.CheckDomainStateCollisions(d, state); d++; } // if collisions are not found in some of the checks we return false if (!isColliding) { return(false); } if (meshCollisions) { // if collisions are found for all our previous checks // We are going a make a final check at the coarser possible resolution // using the whole mesh return(MeshCollisionCheck()); } else { return(true); } }