I know how to do it if the object have only ONE material.
But if there are multi materials, how can I know which material the mouse point to?
I know how to do it if the object have only ONE material.
But if there are multi materials, how can I know which material the mouse point to?
Since no one reply, should I assume it is impossible?
If you’re using raycasts to do your check there’s a triangleIndex in the RaycastHit object. Assuming mesh equality between collider and renderer you could poerhaps take this index to figure out what submesh the triangle belongs to, which would give you the material.
But it might just be easier to split the model per material.
Thanks.
This is complex task including mesh topology analysis. You don’t want to do this. Make fake triggers for clicking around and that’s it.
maybe could put some info in the vertex color or some other (unused) attribute?
so, if selected vertex has color.r==1, then this part is using material#1