Beispiel #1
0
        PoseDataFlags GetPoseData(DeviceType device, TrackedPose poseSource, out Pose resultPose)
        {
            if (m_PoseProviderComponent != null)
            {
                return(m_PoseProviderComponent.GetPoseFromProvider(out resultPose));
            }

            return(PoseDataSource.GetDataFromSource(poseSource, out resultPose));
        }
        PoseDataFlags GetPoseData(DeviceType device, TrackedPose poseSource, out Pose resultPose)
        {
            if (m_PoseProviderComponent != null)
            {
                return(m_PoseProviderComponent.TryGetPoseFromProvider(out resultPose) ? (PoseDataFlags.Position | PoseDataFlags.Rotation) : PoseDataFlags.NoData);
            }

            return(PoseDataSource.GetDataFromSource(poseSource, out resultPose));
        }
Beispiel #3
0
 /// <summary>
 /// This method is used to set the device / pose pair for the SpatialTracking.TrackedPoseDriver. setting an invalid combination of these values will return false.
 /// </summary>
 /// <param name="deviceType">The device type that we wish to track </param>
 /// <param name="pose">The pose source that we wish to track</param>
 /// <returns>true if the values provided are sensible, otherwise false</returns>
 public bool SetPoseSource(DeviceType deviceType, TrackedPose pose)
 {
     if ((int)deviceType < TrackedPoseDriverDataDescription.DeviceData.Count)
     {
         TrackedPoseDriverDataDescription.PoseData val = TrackedPoseDriverDataDescription.DeviceData[(int)deviceType];
         for (int i = 0; i < val.Poses.Count; ++i)
         {
             if (val.Poses[i] == pose)
             {
                 this.deviceType = deviceType;
                 poseSource      = pose;
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #4
0
        private InputDeviceCharacteristics GetSideCharacteristic(TrackedPose type)
        {
            switch (type)
            {
            case TrackedPose.LeftPose:
                return(InputDeviceCharacteristics.Left);

            case TrackedPose.RightPose:
                return(InputDeviceCharacteristics.Right);

            case TrackedPose.RemotePose:
                return(0);

            default:
                return(0);
            }
        }
Beispiel #5
0
        public static mtPoseTrackingDetails FromPoseTrackingEntity(
            PoseTrackingEntity poseTrackingEntity,
            CameraIntrinsics colorIntrinsics,
            Matrix4x4 depthColorTransform)
        {
            mtPoseTrackingDetails details = null;

            var poses = new TrackedPose[poseTrackingEntity.PosesCount];

            poseTrackingEntity.GetPoses(poses);

            var points = new Point[poses.Length];

            colorIntrinsics.ProjectManyOntoFrame(
                poses.Select(p => Multiply(depthColorTransform, p.Position)).ToArray(),
                points);

            details = new mtPoseTrackingDetails()
            {
                EntityId = poseTrackingEntity.EntityId,
                Points   = points
            };
            return(details);
        }