I’m having problems with using motion controllers from C++. Compiling this code:
...
#include "Runtime/HeadMountedDisplay/Public/MotionControllerComponent.h"
#include "VR_Pawn.generated.h"
UCLASS()
class MYPROJECT_API AVR_Pawn : public APawn
{
GENERATED_BODY()
protected:
UMotionControllerComponent* M;
...
gives me this error:
'IMotionController' uses undefined class 'HEADMOUNTEDDISPLAY_API'
As per this question, I modified my Build.cs script to include
PrivateIncludePathModuleNames.Add("HeadMountedDisplay");
and now it works. However, the answer mentions “You should not need to do this, so there appears to be a regression.” and it also seems like a problem to me as well. Is this a (very old, yet still unfixed) problem or am I doing something entirely wrong?
EDIT:
M = CreateDefaultSubobject<UMotionControllerComponent>(FName(TEXT("Left Controller")));
results in:
unresolved external symbol "private: static class UClass * __cdecl UMotionControllerComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UMotionControllerComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: class UMotionControllerComponent * __cdecl UObject::CreateDefaultSubobject<class UMotionControllerComponent>(class FName,bool)" (??$CreateDefaultSubobject@VUMotionControllerComponent@@@UObject@@QEAAPEAVUMotionControllerComponent@@VFName@@_N@Z)
so… not fixed after all.