How to determine the thickness of a mesh along a path

Hi-- I’m trying to find a way to determine the relative thickness of a mesh along a path (a raycast, for instance, but other means are useful too). Basically I want a function that returns the effective thickness oin Unreal Units of a mesh along a segment.
I tried to use a multiline trace by channel creating a new channel and setting all collisions to “overlap”, but given the point where the first collision with the mesh occurs, I don’t know how to figure out where the raycast “exits” the mesh.
Does anybody have any idea?

Hey Hurricane,

You are looking in the right direction!

So your raycast gives an array of different FHitResult's, these are all the ‘hits’ unreal calculated. They save some usefull information but we only need 2 variables from them, the location and the actor/mesh they hitted.

So to find the width of the mesh you need to check each hit’s actor and if it is the actor you want to calculate it’s width from you store the hit’s location.
This will give you 2 points (A,B) and then you just have to calculate the length between them ((B-A).length)

This is an example that will save the width of the first actor it hits:

hope this helps :slight_smile:
Elias

Beautiful, thanks!
I thought that the hit result in a raycast only returned the entry location, not the entry AND exit location.

You aren’t missing anything. FHitResult only gives you the impact point and trace doesn’t hit the same actor twice.

Am I missing something here? I can’t get a multitrace to collide with the same mesh twice.

Oh really? Well you can simulate it yourself using 2 traces. I do everything in c++ so I don’t always test it fully and just explain the expected behavior of these functions…

As PasteDog mentioned, do 2 traces, one trace from start to end, another trace from end to start. Then check if both trace hit same object. So the first trace gives you entry point, and second gives you exit point. Hope it helps.