I need to find the material instance of a single triangle of a mesh. Is this possible?
The object has multiple materials. Using Sharedmaterials I can detect if the material I’m looking for is present on the object, but not if it is present on the exact face I hit with raycast.
Or am I missing something?
Anyone have a solution, or is getting the material of a triangle not possible?
I never found a workable solution.
I wanted to find the polygon/material at a particular point of contact. (in my case from WheelCollider)
My only brute-force thought is maybe you can run through all the submesh triangle/vertex entries in the mesh until you find a polygon in which the contact point lies. From there you could find which material is assigned to that submesh.
I think I will have to split my object into two parts then… there’s no way to simply get the material assigned to a particular triangle. Would be a nice little feature to add to Unity!
Since all the hard work to find these contact points is already done, its a shame extra data isn’t exposed via script/class. Maybe its too deeply embedded in PhysX or whatever.