How to use "settrackingorigin" from c++


I followd this guid about setting up the google vr (daydream) and it worked fine:

However I would like to base my VR-Pawn on a C++ class instead of using blueprints, and I would also like to move as much functionality as possible from the BP-Implementation to C++.
In the tutorial we are told to invoke the BP-function “Set Tracking Origin” but I would like to do that in C++.

The Class FGoogleVRHMD defined in the file Epic Games\UE_4.20\Engine\Plugins\Runtime\GoogleVR\GoogleVRHMD\Source\GoogleVRHMD\Private\GoogleVRHMD.h has the function

virtual void SetTrackingOrigin(EHMDTrackingOrigin::Type) override;

So I made a new C+±Class that derives from APawn, and I also added the following lines to my build.cs:

PublicDependencyModuleNames.AddRange(new string] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “GoogleVRHMD” });
PrivateDependencyModuleNames.AddRange(new string] { });
PublicIncludePaths.AddRange(new string] { “GoogleVRHMD/Public”, “GoogleVRHMD/Classes” });

Now I can use the following include in myPawn.cpp

#include “GoogleVRHMD/Private/GoogleVRHMD.h”

So far, so good.

But how do I access the aformentioed function?

Best regards,

Hey, SetTrackingOrigin is part of the UHeadMountedDisplayFunctionLIbrary not from APawn, of course you can’t, you should include [TABLE=“cellspacing: 0”]
[TR=“class: cke_show_border”]

and also be sure you are including “HeadMountedDisplay” module



thank you, that solved it. Everything I wrote about my changes in build.cs was pretty much useless.
Instead I followed your advice and also included the GoogleVRController-Module

PublicDependencyModuleNames.AddRange(new string] { “Core”, “CoreUObject”, “Engine”, “InputCore”, “HeadMountedDisplay”, “GoogleVRController” });

so I cloud use

#include “HeadMountedDisplayFunctionLibrary.h”
#include “GoogleVRMotionControllerComponent.h”

and that solved all problems.

Thank you.