UE4.24版本MotionController无法连接HTC Tracker

查询到有效信息是4.24版本的MotionController的source设置为Special_1是无效的,尝试按照网上教程设置SteamVR也是无效的,升级到4.25版本也无效。
神奇的UE4版本升级最终还是用C++代码调用USteamVRFunctionLibrary库实现了

  TArray<int32> DeviceIds;
  TArray<int32> TrackerIds;
  USteamVRFunctionLibrary::GetValidTrackedDeviceIds(ESteamVRTrackedDeviceType::Controller, DeviceIds);
  USteamVRFunctionLibrary::GetValidTrackedDeviceIds(ESteamVRTrackedDeviceType::Other, TrackerIds);
  DeviceIds.Append(TrackerIds);

  if (DeviceIds.Num() > 0)
  {
    FVector loc;
    FRotator rot;
    USteamVRFunctionLibrary::GetTrackedDevicePositionAndOrientation(DeviceIds[0], loc, rot);
    TrackerMesh->SetRelativeLocationAndRotation(loc, rot);
  }

猜你喜欢

转载自blog.csdn.net/qq_31042143/article/details/106325015