Physical Material / Get Surface Type Error

Hi . When i want to get surface type by Hit Trace . I Get This Error .
:: Error Accessed None ‘CallFunc_BreakHitResult_PhysMat’ from node Construction Script in blueprint BP_MyHUD.
i Think Its some sort of bug . please fix it EPIC .

Hey tx2line,

Would you mind providing me with either some reproducible steps to get to this error, or a screenshot of your blueprint set up?

Thank you,

Andrew Hurley

Hi and Thanks for your responding :

It always return Default Surface . and i set also set Physic Material to Skeletal Physic Asset . but no luck

Hey again tx2line,

The error message you are receiving is usually caused by a redirect file path that has been deleted, moved, or is missing.

Go into your content browser and find the material you are using for your ‘Physical Material’ and re-apply it to the surface in which you are trying to run the hit trace. Then within the Blueprint where you are applying this ‘Physical Material’, be sure you are using the correct file path.

Re-compile and test the issue. Hopefully this resolves your problem, but if you still need help let me know and we can troubleshoot further. Also there is some helpful documentation on Blueprint Communications and how to reference Actors within Blueprints. Have a read through these as well to see if you can find something that could be useful to you.

Blueprint Communications
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintComms/index.html

How to Reference Actors in Blueprints
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/ReferenceAssets/Blueprints/index.html

Cheers,

Andrew Hurley

This function is working on 4.7p8:

EPhysicalSurface UGameplayStatics::GetSurfaceType(const struct FHitResult& Hit)

But this one got broken; and both uses Hit.PhysMaterial.Get() so this is weird issue:

void UGameplayStatics::BreakHitResult(const FHitResult& Hit, bool& bBlockingHit, float& Time, FVector& Location, FVector& Normal, FVector& ImpactPoint, FVector& ImpactNormal, UPhysicalMaterial& PhysMat, AActor& HitActor, UPrimitiveComponent*& HitComponent, FName& HitBoneName, int32& HitItem)**

Hey BrUnO,

Apologies for the late response, but would you mind checking to see if this issue is still present in the latest release of 4.7.1?

If so, we can move forward with writing an official bug report for your issue.

Thank you,

Andrew Hurley

The issue is back; and now for ANY function related to surface types.
Tested on 4.7.2, every single way of getting a surface type is broken.

Hey BrUnO XaVIeR,

I set up a test bed to return the Physical Material Type of a Cube Mesh when overlapping a trigger volume, and to Print the surface type to the screen. My approach is a bit basic, and does not involve Sub-Material situations or Skeletal Mesh, but hopefully the approach can be applied in your case.

Here is how I set up my Level Blueprint to return the Physical Material. You do mention you are using Hit Traces which I am not implementing in my example, so if this is not what you are looking for, that is fine also.

Physical Material Level BP

After looking at your question a bit more this seems directly related to the ‘Switch On EPhysicalSurface’ node. I will try to re-create an example from the image you provided and return here with my findings.

Cheers,

Andrew Hurley

Hey BrUnO XaVIeR,

I created a new test bed and was able to successfully confirm what you are reporting. I created a bug report for the issue as well with the ticket number UE-11374.

I will keep you informed as to the progress of this bug as well as any extra information I discover.

Cheers,

Andrew Hurley

Any updates on this bug? Running into the same thing right now, trying to implement per-surface footstep sounds!

Suddenly working for me… must have jogged something that got it going again.

Do you know what you changed to get it working? This could provide some insight as a workaround for others who might be experiencing this problem. Any insight would be much appreciated!

Thank you,

Andrew Hurley

Hmm, not sure exactly… I was just going through the PhysicalMaterials I’d created (Sand/Stone/etc.), re-saving them just to make sure, and also saved/closed/reopened the project, and at some point it just started working. Wish I could be of more help!

Ok, no worries! Thank you for the information you have provided though!

Yeah sure! Made this into a handy macro for getting the surface type under the player pawn:

Well, for us it’s still not working reliably in 4.8.3. Sometimes we get the correct physical material with a LineTrace, but most of the time it just returns the default. It seems on static meshes it works more often than on skeletal meshes. We didn’t get it to work on landscapes ever.

Be sure the component being moved that wants the physical material from the result needs to set “bReturnMaterialOnMove” to true.

Also doing per surface footsteps and found you also need to assign a “Default Phys Material” to the actual Landscape to make those work. It’s a separate setting from the material itself. You can find it in the Details tab.