* @return Target class or null if not found.
*/
@SuppressWarnings("rawtypes")
public static Actor hit(float x, float y, Stage stage, Class targetClass)
{
Group root = stage.getRoot();
SnapshotArray<Actor> children = root.getChildren();
Actor hit = null;
boolean found = false;
int index = children.size - 1;
while (!found && index >= 0)
{
Actor child = children.get(index);
point.x = x;
point.y = y;
root.localToDescendantCoordinates(child, point);
Actor childHit = root.hit(point.x, point.y, true);
if (childHit != null && childHit.getClass().isAssignableFrom(targetClass))
{
found = true;
hit = childHit;