How to make Line Trace ignoring transparent part of a texture?

Using a sprite-based enemies like in old games.
Tracing a sprite via Line Trace (sprite have an alpha channel for translucency).
The Line Trace is hitting the whole sprite no matter whether it a transparent space or visible.

How to ignore invisible part of a sprite? Need only hitting a visible picture.

1 Like

W̶h̶a̶t̶ ̶i̶s̶ ̶y̶o̶u̶r̶ ̶t̶r̶a̶c̶e̶ ̶c̶h̶a̶n̶n̶e̶l̶?̶ ̶I̶f̶ ̶y̶o̶u̶ ̶t̶r̶a̶c̶e̶ ̶b̶y̶ ̶v̶i̶s̶i̶b̶i̶l̶i̶t̶y̶ ̶I̶ ̶t̶h̶i̶n̶k̶ ̶i̶t̶ ̶s̶h̶o̶u̶l̶d̶ ̶w̶o̶r̶k̶ ̶a̶s̶ ̶y̶o̶u̶ ̶w̶a̶n̶t̶.̶ ̶I̶f̶ ̶i̶t̶ ̶d̶o̶e̶s̶n̶’̶t̶ ̶t̶h̶e̶n̶ ̶m̶a̶k̶e̶ ̶s̶u̶r̶e̶ ̶y̶o̶u̶r̶ ̶m̶a̶t̶e̶r̶i̶a̶l̶ ̶i̶s̶ ̶m̶a̶s̶k̶e̶d̶ ̶n̶o̶t̶ ̶t̶r̶a̶n̶s̶l̶u̶c̶e̶n̶t̶.̶

On linetrace you can grab the material of the component and draw it to render target and use Read Render Target Raw UV. UV’s you can get with find collision UV node (need to enable support uv from hit result in project setting) and then just check the alpha value.

It doesn’t matter, collision doesn’t take alpha channel into consideration, it’s solely based on collision volumes and the collision type. Intuitively it seems that the Visibility channel should ignore invisible parts, but that’s just a name and that’s it.

Must have imagined it then.

Here is a solution:

1 Like

Mate, you’re right! Thanks a lot!

is there any performance hit to doing this ? whats the negative?

This solution is fine. No performance issues at all. I’m OP, btw :slight_smile: So feel free to ask me anything.

1 Like