Ignore Line Trace for Masked parts of objects?

So apparently this is something the Editor does in PIE natively.
If you have half of an object invisible and the other half of it visible via material masking, the half invisible is ignored and when you click inside the editor whatever is visible gets selected.

However at runtime, the above is not the case. Instead at runtime, when you click and do a line trace, it will just resort to channel/object configuration.

How to get line traces more like the editor when it comes to material masking/opacity?

If you know how to determine if a material is masked at specific UV-coordinates (I don’t know how), the FindCollisionUV function could help which you can activate in the project settings with “Support UV from Hit Results”.

UV.jpg

Thanks for the response.
I’ve actually done this for another game, I got the UVs then with that could get the pixel coordinates on the texture and then with that I could get the color from a texture.
However, in this case I’m not sure how I can get the opacity of a material? I have no texture to reference in this case. I’ll have to think about that.

They definitely do it with the editor somehow, and I’m digging through the source to see how they do it but admitly don’t known where to look precisely.

if you break your hit result you should be able to get access to the material to perform whatever check.

however, if you trace on the visibility channel, is the masked object that is invisible actually considered visible?
that sort of defeats the purpose of the visibility channel, doesn’t it?

well how to get invisible pixels out of the material with no texture to ref? Before I’d look at the texture and get the color at pixel coordinate (x,y), don’t have a texture ref this time.

And yeah that is just a channel name doesn’t seem to be pixel perfect visible/invisible.

EDIT:
Found this

https://answers.unrealengine.com/sto…alinetrace.png
https://answers.unrealengine.com/que…4208/view.html

But that doesn’t seem to work. Despite some parts having alpha of 0, still shows up as full.

Hey did you ever find a way to do this? I’m trying to find a way to do a line trace through transparent/masked materials for months but all I got is ■■■■■■ workarounds that set the collision to overlap with certain triggers.

I’ve realized now that the “Get Material” node is getting the Material asset and not the Shading of the actor.

If the Material asset has a fixed Opacity Mask the “Get Material” node won’t have any problems reading the Alpha

However, if the material opacity is calculated at runtime then it does not affect the material itself so the alpha does not change from the “Get Material” node.