Hey. I’m quite new to unreal, and having some issues with my experiment project.
I have some foliageinstancedStaticMeshComponent that i would like to highlight when pointing at with mouse cursor.
Currently i’m using Get Hit Result Under Cursor by Channel, breaking hit result and then Set Render Custom Depth to highlight with a post process material. The problem is that this will highlight all instances of the same mesh, rather than individual Meshes. I get the index from hit item in the hit result, but can’t find a way to use it to get the correct mesh.
I know that the hit result is correct, because i’m using it to Remove Instance with mouse click, and the correct Mesh will be removed.
I did see that Set Custom Data Value will allow me to pass the index to the material, but as i don’t want to customize the materials for every possible item, but rather use the highlight through Set Render Custom Depth i don’t really know how to move on. Any Ideas?
I’m no expert on this, but I think this route won’t work, because all instances are basically one mesh.
A very common approach with this sort of thing ( felling trees etc ), is when the player selects the object, to replace it with a normal static mesh or blueprint.
Set Render Custom Depth operates on the entire component, so while you are correct to obtain the index for isolating individual instanced static mesh… instances… the issue is that your next action applies to the entire component.