/// <summary>
 /// Casts a convex shape against the collidable.
 /// </summary>
 /// <param name="castShape">Shape to cast.</param>
 /// <param name="startingTransform">Initial transform of the shape.</param>
 /// <param name="sweep">Sweep to apply to the shape.</param>
 /// <param name="filter">Test to apply to the entry. If it returns true, the entry is processed, otherwise the entry is ignored. If a collidable hierarchy is present
 /// in the entry, this filter will be passed into inner ray casts.</param>
 /// <param name="hit">Hit data, if any.</param>
 /// <param name="hitChild">Child hit by the cast.</param>
 /// <returns>Whether or not the cast hit anything.</returns>
 public bool ConvexCast(CollisionShapes.ConvexShapes.ConvexShape castShape, ref RigidTransform startingTransform, ref Vector3 sweep, Func<BroadPhaseEntry, bool> filter, out RayHit hit, out CompoundChild hitChild)
 {
     hit = new RayHit();
     hitChild = null;
     BoundingBox boundingBox;
     castShape.GetSweptBoundingBox(ref startingTransform, ref sweep, out boundingBox);
     var hitElements = PhysicsResources.GetCompoundChildList();
     if (hierarchy.Tree.GetOverlaps(boundingBox, hitElements))
     {
         hit.T = float.MaxValue;
         for (int i = 0; i < hitElements.Count; i++)
         {
             var candidate = hitElements.Elements[i].CollisionInformation;
             RayHit tempHit;
             if (candidate.ConvexCast(castShape, ref startingTransform, ref sweep, filter, out tempHit) && tempHit.T < hit.T)
             {
                 hit = tempHit;
                 hitChild = hitElements.Elements[i];
             }
         }
         PhysicsResources.GiveBack(hitElements);
         return hit.T != float.MaxValue;
     }
     PhysicsResources.GiveBack(hitElements);
     return false;
 }