GetClosestContact /Box2D physics

ETHEntity@ GetClosestContact(vector2 a, vector2 b, vector2& outPoint, vector2& outNormal)

Casts a ray from a to b and returns a handle to the first entity-body found in the way between the two points. If no entity-body intersects the segment, this function returns null.

If any entity is found, this function copies into outPoint the exact point, in world space, where the closest intersection happened, and copies into outNormal its surface normal.

Sample:

vector2 characterPos(200, 300);
vector2 potOfGoldPos(500, 800);

vector2 point, normal;
ETHEntity@ firstEntityFound = GetClosestContact(characterPos, potOfGoldPos, point, normal);

if (firstEntityFound !is null)
{
    if (firstEntityFound.GetEntityName() == "potOfGold.ent")
        print("The character sees the pot of gold!");
    else
        print("Something is in front of our view! The character can't see the pot of gold!");
}
else
{
    print("Nothing was found!");
}

Notice that the intersection tests are only performed on entities that have physics-simulated bodies.