在迭代OculusInputDevice IMotionController
的FMotionControllerSource
数组后,我发现了一个基于它的ETrackingStatus的连接的Oculus左右触摸控制器。使用左控制器和右控制器,我可以使用Returns the calibration-space orientation of the requested controller's hand
的IMotionController
API获取位置和旋转。
下面是对IMotionController接口的引用:https://docs.unrealengine.com/en-US/API/Runtime/HeadMountedDisplay/IMotionController/index.html
我想将位置/旋转应用于PosableMesh
,这样网格就会显示在眼球控制器实际所在的位置。目前,使用下面的代码,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);
}
发布于 2019-12-07 01:21:10
将相机位置添加到控制器位置似乎可以解决这个问题:
// get camera reference during BeginPlay:
camManager = GetWorld()->GetFirstPlayerController()->PlayerCameraManager;
// TickComponent
poseMesh->SetWorldLocationAndRotation(camManager->GetCameraLocation() + position, rotation);
https://stackoverflow.com/questions/59221945
复制