Download

[Problem/Bug] [UE4.24.1] Landscape surface type always return "Default"

Empty project BP:

  1. In project settings add new surface types
  2. Create physical materials and set up surface types
  3. Create blend layer landscape material
  4. Create landscape and use blend layer material at landscape
  5. Create layers info and set up phys materials
  6. In character BP create while to linetrace my below position and print surface type, when i going to landscape i see Default, but if i try going to static mesh (with simple mats with second paragraph) all good, print return me grass\rock\wood

and when i going to landscape i see errors spam:
Blueprint Runtime Error: “Accessed None trying to read property CallFunc_BreakHitResult_PhysMat”. Blueprint: ThirdPersonCharacter Function: Execute Ubergraph Third Person Character Graph: EventGraph Node: Print String

Yup I am getting this since 4.24.1 as well.

There’s a bug on the UE issue tracker for this particular problem. I am currently going through the recent changes myself, to fix it temporarily. Have you guys had any luck with that already?

Took some digging, but here it goes: It seems the way the physical material is queried on landscapes has been changed between 4.23 (4.24?) and 4.24.1. The change is in Engine/Source/Runtime/Landscape/Private/LandscapeCollision.cpp in line 603.

The new line reads:


HeightfieldRef->UsedPhysicalMaterialArray.Add(GPhysXSDK->createMaterial(1, 1, 1));

I replaced it with the 4.23 code which seemingly fixes, until we get an update in 4.25


const FPhysicsMaterialHandle_PhysX& MaterialHandle = PhysicalMaterial->GetPhysicsMaterial();
HeightfieldRef->UsedPhysicalMaterialArray.Add(MaterialHandle.Material);

It worked! Thank you, you’re a savior!

This is interesting but do I have to rebuild the engine in order to make it work?

It doesn’t work for me T_T

Has been fixed with the new HotFix

Im Still getting this error it wont register anything but a default reading ever since i upped to 4.24.1

It works!

Thank you @EchelonV !
Our project uses 4.24 and you saved us a lot of time!

PS. Just a note: the current master branch seems to contain the same fix.

I’m on 4.26 and I still can’t get anything but default off my hit surface values.

[USER=“4262361”]ttv kain_marko[/USER]

Try checking “Generate overlap events” on the landscape. In our case for some reason this was also required.

Thanks, this worked! Any idea why this is the case?

No idea to be honest…
We were on a rather tight schedule so the only thing that mattered to us at that moment was the fact that it magically fixed our issue. :slight_smile: