【发布时间】:2019-12-07 00:27:25
【问题描述】:
在遍历 OculusInputDevice IMotionController 的 FMotionControllerSource 数组后,我根据 ETrackingStatus 找到了连接的 Oculus 左右触摸控制器。使用左右控制器,我可以使用IMotionController API 获取位置和旋转,其中Returns the calibration-space orientation of the requested controller's hand。
这是对 IMotionController API 的引用: https://docs.unrealengine.com/en-US/API/Runtime/HeadMountedDisplay/IMotionController/index.html
我想将位置/旋转应用到 PosableMesh,以便网格显示在 Oculus 控制器实际所在的位置。目前,使用下面的代码,3D模型是从相机向下显示的,因此映射比例是关闭的。我认为WorldToMetersScale可能会关闭。当我使用较小的数字时,控制器不会过多地移动 3D 模型,但这可能会搞砸。
FVector position;
FRotator rotation;
int id = tracker.deviceIndex;
FName srcName = tracker.motionControllerSource;
bool success = tracker.motionController->GetControllerOrientationAndPosition(id, srcName, rotation, position, 250.0f);
if (success)
{
poseMesh->SetWorldLocationAndRotation(position, rotation);
}
【问题讨论】:
标签: c++ virtual-reality unreal-engine4 oculus