How would I figure out distance to floor?

Hi

I have an actor blueprint which places a platform in a level. Now, this platform has legs, Ideally, I would like the legs to automatically stretch and reach the floor where ever they are placed in the level. I think I can do the scaling okay what I’m not sure how to do is detect the distance to the floor. I would also like to do a similar thing with walls.

Any idea how I would go about this?

Cheers

Ed

Have you try using linetrace?

No, how would I do that? Could you point me at somewhere I can learn?

Here it’s an example:

1 - the pivot point of the leg or support must be on top, so you can scale the leg downwards:

2 - to determine the size of the leg, I use this script in the constructor, which will use linetrace to get the distance between the pivot point of the leg to the floor (or any other obstacle below), and with that will set the scale of the leg in the Z axis:

3 - result:

and

In case you want to use relative scale instead of world scale:

Where x and y are 0.25 because they are the initial scale of the mesh.

Amazing thanks I’ll try to recreate!!!