/** @return the nearest entity associated to the given actor */ public static EngineEntity getActorEntity(Actor actor) { if (actor == null) { return null; } Object o = actor.getUserObject(); return o instanceof EngineEntity ? (EngineEntity) o : getActorEntity(actor.getParent()); }