【问题标题】:What is the direct equivalent of the Motion API from Windows Phone on Windows 8?与 Windows 8 上的 Windows Phone 的 Motion API 直接等效的是什么?
【发布时间】:2013-05-18 02:36:07
【问题描述】:

我正在尝试将 Windows 手机程序移植到 Windows 8,但为了定位,Motion API 习惯于我有如下代码行

            If Motion.IsSupported Then
            motion = New Motion With {.TimeBetweenUpdates = Me.TargetElapsedTime}
        End If

        If motion IsNot Nothing Then
            Try
                motion.Start()
            Catch
            End Try
        End If

        Dim matrix As Matrix = motion.CurrentValue.Attitude.RotationMatrix

我能找到的最接近的是 OrientationSensor,因为它提供了旋转矩阵。但我不确定,因为还有其他传感器,如倾角计、加速度计等。 我应该使用哪个是最直接的端口?

【问题讨论】:

  • 大多数手机和平板电脑都有这些硬件传感器。很少有通用计算机可以做到。您必须使用硬件拥有的任何一个,无论它是否是您理想的传感器。

标签: c# windows vb.net windows-phone-7


【解决方案1】:

OrientationSensor 是等效的。它结合了来自不同传感器的数据,就像 Windows Phone 中的 Motion API 一样。

来自MSDN Library

如果可用,推荐使用 OrientationSensor 投影;如果不 可用,您可以组合加速度计、陀螺仪和指南针 获得相似的结果。

【讨论】:

    猜你喜欢
    • 2012-07-05
    • 1970-01-01
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    • 2014-04-10
    相关资源
    最近更新 更多