[C++]How can i get The Physics Material with my FHitResult ?

So basicly i want to code a footstep system. And everything just worked fine ! I shot a ray from the player to the ground but then i need the Physicsmaterial from my FHitResult variable. And i have no idea how i can do this.

When you setup the trace parameters, use the following:

TraceParams.bReturnPhysicalMaterial = true;

et voila!

1 Like

and then i need to use my hit or my TraceParams ?

If you use the TraceParams the Hit Result will have the physics material

It’s a smart pointer so you can check if it is valid and then use .Get() to get the actual material pointer.

greetings,
FTC

Once the TraceParams are set up like TheJamsh said, the PhysMaterial variable of FHitResult has a value set.