I got a mesh which has 6 materials, now i want to use mouse click on it to finger out which material i choose ,how can i do to get the element index of the material, please help,thanks a lot
That’s not currently possible. Traces and collisions are made against collision shapes, which are usually different than the rendering mesh and don’t have material information.
So the alternatives are :
- Break the mesh into multiple objects with one material each
- Read the “Hit Item” index from the trace’s “Hit” result, which will tell the index of the collision shape that was hit and hardcode the corresponding materials
- Manually add collision boxes to your actor and make each one change a different material in your mesh
Seems the first way is easier for me… ,BTW i don’t know why the ‘HTI Item’ has always been “-1” wherever i click on,and can i hardcode that by blueprint?which node?thanks again
mine FaceIndex is always -1 as well.