GetClosestContact /Box2D physics

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

Casts a ray from a to b and returns a handle to the first entity-body found in the way between the two points, except if the entity name matches any of the names set in the semicolonSeparatedIgnoreList. 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,
                                                "potOfGold.ent;characer.ent");

if (firstEntityFound is null)
{
    print("The character sees the pot of gold!");
}

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