Hi, I am trying to get the specific physical material from a skeletal mesh to do some stuff. I already set the physical material on each collider of physics asset in editor. But the question is, how can I get it? Thanks for any suggestion.
If I remember correctly, you could take the hit result from the skeletal mesh (rather than the colliders) and “break hit result”, one of the pins exposed being “phys mat”. I am talking blueprint I am not sure how the function is in C++, but generally C++ has more exposed stuff then BP.
For the communities that having the same question. I found the answer myself. If you got the skeletal mesh component, then you can use a bone name to get a body instance of that bone in skeletal mesh.
FBodyInstance* BodyInstance = SkeletalMesh -> GetBodyInstance( BoneName ) ;
After that, you can get the physical material through the body instance.
UPhysicalMaterial* PhyMat = BodyInstance -> GetSimplePhysicalMaterial( ) ;
That’s it.
2 Likes