Ray casting from selected submeshes

Hello, I am trying to ray cast from selected submeshes.

But I am not getting the unexpected result as follow.

What is the correct way to cast a ray from selected submesh

Welcome abroad!
Can you detail a bit more what are you doing on this PG? And what is the expected result?

@carolhmj The imported mesh vertices were re-ordered since the multimat was giving very random colors without any structure. After it was run through the Octree we end up with overlapping octree sections (as shown in the figure) with the bounding box of the grey geometry. This contains the submesh which has penetration/ proximity with the adjoining mesh.

The goal is to select the vertices that are a part of the intersecting submesh and then raycast from those selected vertices. So the submesh by itself gives us the required selection however, when selecting the vertices from this submesh and raycasting from that selection the rays don’t fall on the vertices but are random as seen in the screen shot. So,

  1. is the method of selecting the vertices from the resulting sub mesh correct?
  2. is the reordering of vertices causing the issue?
  3. why is the raycast not aligning on the vertices?

Thank you.

Hi @carolhmj, do you have any updates. Implementation of PG as per @RuAr explanation.
Thanks.

It’s a bit of a complex scenario so I will need some time to go over it. :slight_smile:

@carolhmj We couldn’t figure what was causing the above issue however, the de-construct mesh snippet solved the problem for us. Just leaving it out here for others who might want to take this approach. After re-ordering the vertices on the imported stl file, the snippet gave us submeshs which we could use to raycast and did not cause an issue. It works quite fast too. Pasting the link for the snippet for easy reference.

2 Likes

Glad you found a solution and thanks for leaving it here for the community! Sorry I couldn’t go over it in the proper time :pray: