Physical Material / Surface Type problems

Hello,

We set up our surface types in the project settings, created physics materials, having assigned those surface types and having our physmats applied to the relevant materials and material instances.

Now we’re throwing a sphere object with projectile movement into our scene, and on collision, there are 2 possible outcomes. (non of which we desire)

1: EventHit>Hit>GetSurfaceType>Switch>will always exec Default

2: EventHit>Hit>BreakHitResult>PhysMat>…
“PIE:Error: Error Accessed None ‘CallFunc_BreakHitResult_PhysMat’ from node Construction Script in blueprint BP_WeaponProjectile”

If i’m printing the HitActor.DisplayName, HitComponent.Material.DisplayName it appears to collide with the correct object and material.

Also, what i find curious, since the physmat is assigned within any material (and instance) it cannot be accessed from a specific material. Is that on purpose?

We’ve been following the documentation and i don’t think we’ve done anything wrong in particular, and we would very much appreciate any input on the matter.

Thanks
wzl

We didnt revisit the issue yet. It would be nice to have but it is not a critical feature. Seeing how other threads were created about the issue, but went (at least back when i checked) unanswered aswell, we figured it might not be trivial to fix or work around, so we’re currently not relying on it.

Actually, I am with you. Running into the same problem under a different usage. I’m making a footstep sound system, and it works to the point that it only returns the sound associated with the default surface type (even though I have set up types, physical materials, and materials based on those). I wonder if you and I are having the same problem, and if so… did you fix it?

Hello,
Thank you for your report. We were not able to investigate this on the engine version you reported, but there have been many version changes to UE4 since this question was first posted. With a new version of the Engine comes new fixes and it is possible that this issue has changed or may no longer occur. Due to timetable of when this issue was first posted, we are marking this post as resolved for tracking purposes.
If you are still experiencing the issue you reported in the current engine version, then please respond to this message with additional information and we will investigate as soon as possible. If you are experiencing a similar, but different issue at this time, please submit a new report for it.
Thank you.

I think I’ve got the same problem with landscapes currently in 4.6. I have done the following:

  • create a project based on the “First Person” template
  • added some code in “…Projectile.cpp > OnHit” to retrieve the physical material from the hit result
  • created a test level with the editor and added a landscape to it
  • set up some surface types in the project settings
  • created a physical material “PM_Grass” referencing the “Grass” surface type
  • setup the physical material of a grass material from the starter content to be “PM_Grass”
  • given that material to my landscape
  • even tried setting the “Default Phys Material” of the landscape in the editor

When I shoot a projectile on the landscape it always returns “DefaultPhysicalMaterial” in the Hit result. The associated “PhysicalMaterialProperty” is NULL and the “SurfaceType” is “SurfaceType_Default” (0).

Now I don’t know maybe there is something I didn’t do. I thought I should post here instead of directly posting a new question. Restarting the editor did not help. It does when material is applied to meshes though. There I can get the correct physical material.

If you can get a HitResult structure then try this

You should be able to get your surface type from the material of the hit component.

Wow thanks. I was stuck on this too, see (PhysMat issues :( - Album on Imgur)

The doc states that a boolean value related to the collision query must be set to true in order to bind the PhysMat in the HitResult. I don’t know where to set this value in blueprints though.
At least, we can get the surface type thanks to the hitcomponent pin but this involves 2 extra nodes(Get Material and Get Physical Material) while this info seems to be quite ready to consume from PhysMat pin.

I am having this problem, I can’t get any physical material from componentHit results. It either shows up as none, or Default when I print out any of these work arounds.

Hello All,

A bug report has been created for this issue with the tag UE-9829 and is scheduled to be fixed in version 4.8.

With that in mind, we appreciate your patience while we work on fixing this issue. If you have any other questions or need additional help please let us know.

Cheers,

Im using 4.10 and this is still not fixed… This is a BIG bug and is giving me a lot of trouble, none of the below work-around work for my setup.

The bug fix was just to change the description and not the functionality of the get physical material. The comments in the report also suggest the user was going about this incorrectly, and the component being moved that wants the physical material from the result needs to set “bReturnMaterialOnMove” to true.

If you are already doing this, could you provide me with some screenshots of your set up so I can test the issue on my end as well?

Thanks,

For everyone new to this post !
What you may need to do is :

  1. Go to your landscape collision settings.

  2. Set “Simple Collision Mip Level” to a value more than “Collision Mip Level”, example : “Collision Mip level = 0”,
    “Simple Collision Mip level = 1” (Simply doing that worked for me).

Voilà.

Thank you for this. I was having trouble getting my vehicle wheels to register what was below them. My landscape turned a blackish-grey colour after I did this, but was able to get it back to normal after re-setting the simple collision mip level back to 0. This still kept the functionality I was looking for… Apparently we have to jiggle the engine every so often.