protected Entity getNearestEntity(Vector filteredEntities)
{
Entity tempEntity = null;
Entity nearestEntity = null;
Origin currentPos = getPosition();
float tempDistance = 0;
float distance = Float.MAX_VALUE;
for(int i = 0; i < filteredEntities.size(); i++)
{
tempEntity = (Entity)filteredEntities.elementAt(i);
tempDistance = currentPos.distance(tempEntity.getOrigin());
if(tempDistance < distance && tempDistance > 0)
{
distance = tempDistance;
nearestEntity = tempEntity;