submesh index property ?

Hi,

I’d like to be able to know which material is currently under the mouse pointer. The scene contains multi-meshes (objects with multi materials applied).
I am looking at some code to cast a ray and get the pointed triangle. I’m also looking at the API docs regarding sub meshes.

Though, if anyone had a hint on the subject, it’d be greatly appreciated.

1 Answer

1

This seems like an oversight in the API. Unless someone knows a better way, what I would try is a test: make an object with 2 or 3 simple submeshes. Let’s say cubes. So you know there should be 12 tris per submesh. Then RayCastHit it, each submesh, and see what index it gives you. Perhaps maybe it will say 18, which would indicate the 6th tri in the second sub-mesh???