How to highlight a given component in C++ with raycasting?

Hi all,

As the title says, I’m trying to figure out how to highlight a Static Mesh component when the raycast hits it.

Create a material for the outline.

https://www.tomlooman.com/multi-colo…real-engine-4/

Use a post process volume, set it to unbound and give it the material. When the raycast hits the object, set the static mesh component -> render custom depth to true.

Thank you for your answer. But my actor have a few UStaticMeshComponents. So I created a different class for this specific UStaticMeshComponent and I wish my raycast detects this specific StaticMesh Component only (by my custom class). Not other UStaticMeshComponents. Should I use raycasting by channel if I set this one component to a different channel?

I assume C++ since you are using prefixes.

Linetraces return a struct FHitResult.

From the FHitResult you can get the Component and see if it was the component you wanted to check for.

Ok, thank you for your precious help.