1

I am developing an app for tvOS and I want when the user shakes the remote, or moves it in a downward slash, that an event gets triggerred. But apple's documentation mostly focuses on registering button presses and the focus engine.

Can anyone help me with how I can access the accelometer?

Thank you for your help

Yannis P.
  • 811
  • 1
  • 11
  • 32

2 Answers2

1

To use the motion sensing aspects of the Siri Remote, you need to treat it as a game controller. See Working with Game Controllers in App Programming Guide for tvOS and the GCMotion class.

rickster
  • 124,678
  • 26
  • 272
  • 326
0

While it's fairly easy to port an ios game to tvos, note the following limitation that did slow me down as originaly I was using the rotation feature and expected to be the same on the remote, I had overlooked it in the doc but it says "Although the remote supports motion data (and the GCMotion profile), the remote cannot determine the attitude or rotation of the remote. The corresponding properties always return constant values." And the constant values as per the tvOS header GCMotion.h are:

@note Remotes can not determine a stable rotation rate so the values will be (0,0,0) at all times.
@note Remotes can not determine a stable attitude so the values will be (0,0,0,1) at all times.
Bluedays
  • 151
  • 5