VR Expansion Plugin

ResetOrientationAndPosition() has been driving me crazy so I came up with a solution that works well with the Valve Index in UE 4.21.2, which I am still using for backward compatibility with other projects. But looking at the source for SteamVR in 4.26.2, it is still doing the same thing as before.

void AAlkCharacter::OnRecenterXR() {
  auto xrTrackingSystem = GEngine->XRSystem; // interface to HMD
  if (!xrTrackingSystem)
    return;
  auto posBefore = xrTrackingSystem->GetBasePosition();
  UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition();
    // !!! ^ in room scale, position Z will be offset to the floor
  auto posAfter = xrTrackingSystem->GetBasePosition();
  xrTrackingSystem->SetBasePosition(
    FVector(posAfter.X, posAfter.Y, posBefore.Z));
}