@SuppressWarnings("rawtypes")
public static Actor intersects(float x, float y, float width, float height, Group group, Class targetClass)
{
SnapshotArray<Actor> children = group.getChildren();
Actor hit = null;
int index = children.size - 1;
while (hit == null && index >= 0)
{
Actor child = children.get(index);
point.x = x;
point.y = y;
group.localToDescendantCoordinates(child, point);
// If child is our target class then immediately check for
// intersection
if (child.getClass().equals(targetClass))
{
if (isIntersect(point.x, point.y, width, height, 0, 0, child.getWidth(), child.getHeight()))
{
hit = child;
}
}
else if (child instanceof Group)