Download

Different decal approach, guidance needed.

Hello, i have a decal for a bullet hole. I have around 10 different materials for each surface type, dirt, stone, wood, etc. I am unsure of how i would go about getting the surface that was hit.

How would you go about getting the surface hit material and selecting the correct decal material to spawn?

Previously i used tags on my objects to determine what surface was hit but thinking back on that method a few years on wards it doesn’t seems like the best method.

Thanks in advance.

physical materials. Create and apply physical materials to your standard materials and then you can detect what physical material you have hit (break the hit result for the details) and therefore what surface type you have. I have read about it a couple of times but not actually used it myself. Google will find specific instructions with little bother I think.

Never thought of that i will have a look, thanks for the help.

The ShooterGame has an example of how to do this in C++. I’d also recommend the Ballistics FX asset on the UE4 marketplace, which implements a full featured Impact FX system in blueprints.

To add to Podgyhodgy’s comment about adding physical materials to materials, you’ll need to:

  1. Configure surfaces in Project Settings
  2. Create Physical Materials that use these surfaces
  3. Assign Physical Materials to Materials
  4. Access the Phys Mat from the Hit result after you do a trace or respond to a collision. For traces to return a physical material, make sure bReturnPhysicalMaterial is set in the collision query params. For collisions of primitives, make sure bReturnMaterialOnMove flag is set.

Both the projects I mentioned above do this.