Event handler - mouse pointing over polygon

Is it possible to do determine if mouse pointer is hovering over specific polygon in edit mode? (in 2.8).
I would like to change polygon color in 3d view if mouse is point over polygon. I used to that in Modo and I would like to code similair behavior.

1 Like

open text editor in blender > templates > python > Operator Modal View3D Raycast>
it shows how to raycast from the mouse to the scene and get which polygon it hits:

# cast the ray
    success, location, normal, face_index = obj.ray_cast(ray_origin_obj, ray_direction_obj)
1 Like