title: Air mouse for Android, which sensor?
body: <p>I'm working on an app that uses the smartphone to control the pointer on a desktop. I saw many app of this type on the store so I know it isn't impossible! I'm doing this for university, I'm not looking for the perfect app but I can't figure which sensor should I use... I tried to use the rotation vector sensor and it's good for pitch (y values of pointer) but not the same for azimuth (for the x axis)... I didn't filter values. Do you think I have to change sensor or is it just a matter of filtering data? Any tips? </p>
  
  <p>EDIT: Gyro mouse in Ali's video is really smooth and accurate and it says it's very simple to do but not for me! I take the rotation Matrix, get the angle change and then I map it to pixels but it's very inaccurate (the azimuth)! I'll post the code to show clearly what I'm doing:</p>
  
  <pre><code>//get values from Rotation Vector sensor
  SensorManager.getRotationMatrixFromVector(rotationMatrix, sensorValues);
  SensorManager.getAngleChange(orientationValues, rotationMatrix, prevMatrix);
  prevMatrix = rotationMatrix;
  azimuth += orientationValues[0];
  pitch += orientationValues[1];
  
  //getAngleChange returns radians so I multiply by 100
  float dX = (azimuth - lastX)*100.f;
  float dY = (pitch - lastY)*100.f;
  pixel.x += dX;
  pixel.y += dY;
  
  // store values
  lastX = azimuth;
  lastY = pitch;
  prevMatrix = rotationMatrix;
  </code></pre>