Operating system: Linux-4.15.0-136-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.39
Broken: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: rB02948a2cab44
Short description of error
If you have and object with mirror modifiers and obj.raycast on them, the returned face index will be wrong, especially on the mirrored side. If the modifier uses bisect, the face index will be wrong on the original side as well.
I'm only aware of the mirror modifier doings this. For instance, I have boolean modifiers on the object in the sample scene, creating faces only present in the evaluated mesh, and those indices are returned correctly.
edit: The weld mod (if at the end of the stack) seems to be affected as well. Can report separately if necessary.
My current workaround is creating the evaluated meshes manually via bpy.data.meshes.new_from_object(obj.evaluated_get(dg), depsgraph=dg) and a BVH raycast, but that's not always practical, and I would really prefer doing this on the fly using obj.ray_cast(origin, direction, depsgraph=dg)
The supplied blend file, uses the "operator_modal_view3d_raycast.py" template with minimal modification.
Exact steps for others to reproduce the error
- open the blend file
- run the script in the text editor
- run the Raycast op from the search menu
- click on various faces and compare the raycast results in the terminal to the text objects on the faces, indicating the correct indices on the evaluated mesh