Say you have an object of class Bird and you want to find an intersecting object of class Sky. One way to find that object is to write:
But does there not exist an easier way to do this, without having to go through all Sky objects?
.
public Sky intersectingSky()
{
for (Sky s: getWorld().getObjects(Sky.class))
{
if (s ==getOneIntersectingObject(Sky.class))
{
return s;
}
}
return null;
}
