C# Windows 8上Windows Phone的运动API的直接等价物是什么?
我正在尝试将一个Windows phone程序移植到Windows 8,但对于方向,使用了运动API,我有如下代码行C# Windows 8上Windows Phone的运动API的直接等价物是什么?,c#,windows,vb.net,windows-phone-7,C#,Windows,Vb.net,Windows Phone 7,我正在尝试将一个Windows phone程序移植到Windows 8,但对于方向,使用了运动API,我有如下代码行 If Motion.IsSupported Then motion = New Motion With {.TimeBetweenUpdates = Me.TargetElapsedTime} End If If motion IsNot Nothing Then Try
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
我能找到的最接近的是方向传感器,因为它提供了旋转矩阵。但我不确定,因为还有其他传感器,如倾斜仪、加速计等。
我应该使用哪一个是最直接的端口?
方向传感器
是等效的。它结合了来自不同传感器的数据,就像Windows Phone中的运动API一样
从:
如果可用,建议使用方向传感器投影;如果不是
可用时,您可以将加速计、陀螺仪和指南针组合在一起
以获得类似的结果
大多数手机和平板电脑都有这些硬件传感器。很少有通用计算机能做到这一点。你必须使用硬件中的任何一个,无论它是否是你理想的传感器。