derived a custom class from camera component
overrode the begin play method
void UVRCameraComponent::BeginPlay()
{
Super::BeginPlay();
check(GEngine);
if (GEngine->HMDDevice.IsValid())
{
GEngine->HMDDevice->EnableHMD(true);
GetWorld()->GetFirstPlayerController()->ConsoleCommand("stereo on");
GEngine->HMDDevice->EnableLowPersistenceMode(true);
GEngine->HMDDevice->ResetOrientation();
}
}
and added head tracking in the tick function
void UVRCameraComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
FQuat _CamRot;
FVector _CamPos;
GEngine->HMDDevice->GetCurrentOrientationAndPosition(_CamRot _CamPos);
auto rot = _CamRot.Rotator();
SetRelativeRotation(rot.Quaternion());
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}
but the oculus camera does not face the direction of player start. i have checked the camera orientation in the pawn blueprint its initial orientation faces the pawns forward