Download

How to get HMD pose in non-vr mode ??

Hi,
i’ve struggled with this for two days, really need you help!

the things is:
i got a game run in non-vr mode, but need to detected the HMD pose. currently, i use oculus.

what i’ve tryied out:

  1. in the editor mode with oculus plugin enabled, play in preview, i can get the HMD pose.
  2. in a builded package, i cann’t get the pose. but if i switch to vr mode by consule command, then i can get the pose again!

i just use this simple code to get HMD pose:

void UMyLibrary::GetHmdPose(FRotator& DeviceRotation, FVector& DevicePosition)
{
if (GEngine && GEngine->HMDDevice.IsValid())
{
FQuat OrientationAsQuat;
GEngine->HMDDevice.Get()->GetCurrentOrientationAndPosition(OrientationAsQuat, DevicePosition);
DeviceRotation = OrientationAsQuat.Rotator();
}
}

any help would be very appreciated!!