How can I inherit FWheelSimModule class?

I am having struggle to create subclass of FWheelSimModule (it is found in Chaos Modular Vehicle plugin - comes with engine, but it needs to be enabled and it is in experimental state).

What I made is:
AdvancedWheelModule.h

#pragma once
#include "Runtime/Experimental/ChaosVehicles/ChaosVehiclesCore/Public/SimModule/WheelModule.h"

namespace myproject
{
	class PROJECT_API AdvancedWheelModule: public Chaos::FWheelSimModule
	{
	protected:
		bool bPoweredByEngine;
	public:
		AdvancedWheelModule(const Chaos::FWheelSettings& Settings);
	};	
}

And implementation looks like this:
AdvancedWheelModule.cpp

#include "AdvancedWheelModule.h"

#if VEHICLE_DEBUGGING_ENABLED
UE_DISABLE_OPTIMIZATION_SHIP
#endif

namespace myproject
{
	AdvancedWheelModule::AdvancedWheelModule(const Chaos::FWheelSettings& Settings): Chaos::FWheelSimModule(Settings)
	{
		bPoweredByEngine = true;
	}
}

And when I try to build, I get lot of errors which don’t make sense to me. Here are first few lines of errors:

0>AdvancedWheelModule.cpp.obj: Error  : LNK2001: unresolved external symbol "public: virtual class TSharedPtr<struct Chaos::FModuleNetData,1> __cdecl Chaos::FSimFactoryModule<struct Chaos::FWheelSimModuleData>::GenerateNetData(int)const " (?GenerateNetData@?$FSimFactoryModule@UFWheelSimModuleData@Chaos@@@Chaos@@UEBA?AV?$TSharedPtr@UFModuleNetData@Chaos@@$00@@H@Z)
0>AdvancedWheelModule.cpp.obj: Error  : LNK2019: unresolved external symbol "__declspec(dllimport) public: static class Chaos::FModuleFactoryRegister & __cdecl Chaos::FModuleFactoryRegister::Get(void)" (__imp_?Get@FModuleFactoryRegister@Chaos@@SAAEAV12@XZ) referenced in function "bool __cdecl Chaos::RegisterFactoryHelper<class Chaos::FWheelSimFactory>(void)" (??$RegisterFactoryHelper@VFWheelSimFactory@Chaos@@$$V@Chaos@@YA_NXZ)
0>AdvancedWheelModule.cpp.obj: Error  : LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Chaos::FModuleFactoryRegister::RegisterFactory(unsigned int,class TWeakPtr<class Chaos::IFactoryModule,1>)" (__imp_?RegisterFactory@FModuleFactoryRegister@Chaos@@QEAAXIV?$TWeakPtr@VIFactoryModule@Chaos@@$00@@@Z) referenced in function "bool __cdecl Chaos::RegisterFactoryHelper<class Chaos::FWheelSimFactory>(void)" (??$RegisterFactoryHelper@VFWheelSimFactory@Chaos@@$$V@Chaos@@YA_NXZ)

Can anyone point me what am I doing wrong?

If anyone runs into this issue, problem was that in .build.cs I was missing following dependency: ChaosVehiclesCore.

So dependency list should look like this:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "ChaosModularVehicleEngine", "ChaosVehiclesCore" });

1 Like