ray_cast face index with n_gons #36363

Closed
opened 2013-08-03 16:13:43 +02:00 by patrick moore · 4 comments

%%%--- Operating System, Graphics card ---
Windows 7 64.

- Blender version with error, and version that worked ---

Current build 58838
I have experienced this for a while (5 months?) but just worked around it until I thought it might be proactive to mention it

- Short description of error ---

When using the object.ray_cast() method, if the object has ngons, and the ray intersects the n_gon, the ray_cast
function returns the face_index of the TRIANGULATED n_gon, resulting in face indices that do not exist in in the mesh.
This is troublesome for me, because I'm developing some tools which raycast the users interaction onto the object.
My workaround is to create a temporary object and triangulate it.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---

Open blender default scene
Add a cylinder primitive with ngon caps

in the python console type the following:

from mathutils import Vector
C.object.ray_cast(Vector((0,0,0)),Vector((0,0,2)))

(Vector((0.0, 0.0, 0.9999999403953552)), Vector((0.0, 0.0, 0.9999999403953552)), 45)

Notice it returns 45 as the face index but there are only 34 faces in the cylinder primitive.
%%%

%%%--- Operating System, Graphics card --- Windows 7 64. - Blender version with error, and version that worked --- Current build 58838 I have experienced this for a while (5 months?) but just worked around it until I thought it might be proactive to mention it - Short description of error --- When using the object.ray_cast() method, if the object has ngons, and the ray intersects the n_gon, the ray_cast function returns the face_index of the TRIANGULATED n_gon, resulting in face indices that do not exist in in the mesh. This is troublesome for me, because I'm developing some tools which raycast the users interaction onto the object. My workaround is to create a temporary object and triangulate it. - Steps for others to reproduce the error (preferably based on attached .blend file) --- Open blender default scene Add a cylinder primitive with ngon caps in the python console type the following: from mathutils import Vector C.object.ray_cast(Vector((0,0,0)),Vector((0,0,2))) >>>(Vector((0.0, 0.0, 0.9999999403953552)), Vector((0.0, 0.0, 0.9999999403953552)), 45) Notice it returns 45 as the face index but there are only 34 faces in the cylinder primitive. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%fixed r58950.%%%

%%%fixed r58950.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

%%%Thanks!%%%

%%%Thanks!%%%
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#36363
No description provided.