简体   繁体   English

什么是Windows 8上Windows Phone的Motion API的直接等价物?

[英]What is the direct equivalent of the Motion API from Windows Phone on Windows 8?

I'm trying to port a Windows phone program to windows 8, but for orientation the Motion API is used to I have lines of code like the following 我正在尝试将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

The closest I could find was OrientationSensor because it provides the rotation matrix. 我能找到的最接近的是OrientationSensor,因为它提供了旋转矩阵。 But I'm not sure since there are other sensors like the inclinometer, accelerometer, and so on. 但我不确定,因为还有其他传感器,如倾角仪,加速度计等。 Which one should I use that would be the most direct port? 我应该使用哪一个最直接的端口?

OrientationSensor is the equivalent one. OrientationSensor是等效的。 It combines data from different sensors, as the Motion API does in Windows Phone. 它结合了来自不同传感器的数据,就像Motion Phone在Windows Phone中所做的那样。

From the MSDN Library : MSDN库

If available, the OrientationSensor projection is recommended; 如果可用,建议使用OrientationSensor投影; if not available, you may combine the accelerometer, gyrometer, and compass to obtain similar results. 如果没有,您可以组合加速度计,陀螺仪和指南针以获得类似的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM