erotavlas
erotavlas

Reputation: 4493

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

            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. 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?

Upvotes: 3

Views: 337

Answers (1)

anderZubi
anderZubi

Reputation: 6424

OrientationSensor is the equivalent one. It combines data from different sensors, as the Motion API does in Windows Phone.

From the MSDN Library:

If available, the OrientationSensor projection is recommended; if not available, you may combine the accelerometer, gyrometer, and compass to obtain similar results.

Upvotes: 1

Related Questions