[4.7.4] Why is status of vision tracking disabled for Oculus HMD in Shipping builds?

I am attempting to handle the case of the HMD going out of tracking range by fading out the screen. I determine this by callling UHeadMountedDisplayFunctionLibrary::HasValidTrackingPosition( ). This function checks Flags.bHmdPosTracking && Flags.bHaveVisionTracking. Unfortunately, Flags.bHaveVisionTracking is only getting updated in non-UE_BUILD_SHIPPING builds. I noticed the steamvr is not limited in the same way.

Is there a reason to disable in shipping?

Hi, in source code of 4.7.6 i found this

at Engine\Source\Runtime\Engine\Private\HeadMountedDisplayFunctionLibrary.cpp

bool UHeadMountedDisplayFunctionLibrary::HasValidTrackingPosition()
{
if(GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsHeadTrackingAllowed())
{
return GEngine->HMDDevice->HasValidTrackingPosition();
}

return false;

}

and there isn’t any checks for UE_BUILD_SHIPPING

but when i searched for Flags.bHaveVisionTracking, there is #if !UE_BUILD_SHIPPING at Engine\Plugins\Runtime\OculusRift\Source\OculusRift\Private\OculusRiftHMD.cpp

void FOculusRiftHMD::GetCurrentPose(FQuat& CurrentHmdOrientation, FVector& CurrentHmdPosition)
{
	check(IsInGameThread());
	check(Hmd);

	if (Flags.bNeedUpdateStereoRenderingParams)
		UpdateStereoRenderingParams();

	// Save eye poses
	ovrTrackingState ts;
	ovrVector3f hmdToEyeViewOffset[2] = { EyeRenderDesc[0].HmdToEyeViewOffset, EyeRenderDesc[1].HmdToEyeViewOffset };
	ovrHmd_GetEyePoses(Hmd, GFrameNumber, hmdToEyeViewOffset, EyeRenderPose, &ts);

	const ovrPosef& ThePose = ts.HeadPose.ThePose;
	PoseToOrientationAndPosition(ThePose, CurrentHmdOrientation, CurrentHmdPosition);
	//UE_LOG(LogHMD, Log, TEXT("P: %.3f %.3f %.3f"), CurrentPosition.X, CurrentPosition.Y, CurrentPosition.Y);

	LastFrameNumber = GFrameNumber;

#ifdef OVR_VISION_ENABLED
	if (Flags.bHmdPosTracking)
	{
#if !UE_BUILD_SHIPPING
		bool hadVisionTracking = Flags.bHaveVisionTracking;
		Flags.bHaveVisionTracking = (ts.StatusFlags & ovrStatus_PositionTracked) != 0;
		if (Flags.bHaveVisionTracking && !hadVisionTracking)
			UE_LOG(LogHMD, Warning, TEXT("Vision Tracking Acquired"));
		if (!Flags.bHaveVisionTracking && hadVisionTracking)
			UE_LOG(LogHMD, Warning, TEXT("Lost Vision Tracking"));
#endif // #if !UE_BUILD_SHIPPING
	}
#endif // OVR_VISION_ENABLED
}

But! in 4.8.0 source code same function different, sure you have to try upgrade copy of your project to 4.8.0 and check if problem solved

void FOculusRiftHMD::GetCurrentPose(FQuat& CurrentHmdOrientation, FVector& CurrentHmdPosition, bool bUseOrienationForPlayerCamera, bool bUsePositionForPlayerCamera)
{
	check(IsInGameThread());

	auto frame = GetFrame();
	check(frame);

	if (bUseOrienationForPlayerCamera || bUsePositionForPlayerCamera)
	{
		// if this pose is going to be used for camera update then save it.
		// This matters only if bUpdateOnRT is OFF.
		frame->EyeRenderPose[0] = frame->CurEyeRenderPose[0];
		frame->EyeRenderPose[1] = frame->CurEyeRenderPose[1];
		frame->HeadPose = frame->CurTrackingState.HeadPose.ThePose;
	}

	frame->PoseToOrientationAndPosition(frame->CurTrackingState.HeadPose.ThePose, CurrentHmdOrientation, CurrentHmdPosition);
	//UE_LOG(LogHMD, Log, TEXT("CRHDPS: Pos %.3f %.3f %.3f"), frame->CurTrackingState.HeadPose.ThePose.Position.x, frame->CurTrackingState.HeadPose.ThePose.Position.y, frame->CurTrackingState.HeadPose.ThePose.Position.z);
	//UE_LOG(LogHMD, Log, TEXT("CRPOSE: Pos %.3f %.3f %.3f"), CurrentHmdPosition.X, CurrentHmdPosition.Y, CurrentHmdPosition.Z);
	//UE_LOG(LogHMD, Log, TEXT("CRPOSE: Yaw %.3f Pitch %.3f Roll %.3f"), CurrentHmdOrientation.Rotator().Yaw, CurrentHmdOrientation.Rotator().Pitch, CurrentHmdOrientation.Rotator().Roll);
}

I’m waiting for 4.8.2 before upgrading, to let the dust settle. Looks like it could be fixed, which would be great. Once I can confirm this, I’ll mark it as answered. Thanks for the heads up!