UE4 获取SurfaceType

获取SurfaceType的两种方法(我所知道的)

  1. EPhysicalSurface Surface = UPhysicalMaterial::DetermineSurfaceType(Hit.PhysMaterial.Get());
    

      

  2. EPhysicalSurface Surface =UGameplayStatics::GetSurfaceType(Hit);
    

      

第一种,在4.26版本中报如下错误:

无法解析的外部符号 "__declspec(dllimport) public: static enum EPhysicalSurface __cdecl UPhysicalMaterial::DetermineSurfaceType(class UPhysicalMaterial const *)" (__imp_?DetermineSurfaceType@UPhysicalMaterial@@SA?AW4EPhysicalSurface@@PEBV1@@Z)

不知道如何解决,记录一下;

已经找到解决办法,修改 ModuleRules文件,如下:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","PHYSICSCORE" });

  增加了:PHYSICSCORE

第二种,为替代方法,也能正常运行。

麻烦转载的,请注明出处,谢谢。

原文地址:https://www.cnblogs.com/wengnet/p/14301891.html