none
Relocating Bing Map - Accelorometers

    Question

  • Hi,

    I was wondering can anyone help? I working on a game where I would like to move the Bing map based on the accelerometer reading . I.e. As I tilt the device the map will move in that direction. Is this at all possible? I have my accelerometer readings it's just scrolling/moving the map to that reading.

    Thanks

    Ken
    Friday, February 14, 2014 8:02 AM

Answers

  • Sure this can be done. What you can do is set up a timer to update the position of the map based on the accelerometer. When the timer triggers you can offset the position of the map a defined pixel distance in the direction of the tilt. To get the map to move using pixels you can get the map center location, use the Map.TryLocationToPixel method to convert this to a pixel coordinate. Next add your pixel offsets to this value and use the Map.TryPixelToLocation method to get a new coordinate. Use this new coordinate to set the center of the map.


    http://rbrundritt.wordpress.com

    Friday, February 14, 2014 11:07 AM

All replies

  • Sure this can be done. What you can do is set up a timer to update the position of the map based on the accelerometer. When the timer triggers you can offset the position of the map a defined pixel distance in the direction of the tilt. To get the map to move using pixels you can get the map center location, use the Map.TryLocationToPixel method to convert this to a pixel coordinate. Next add your pixel offsets to this value and use the Map.TryPixelToLocation method to get a new coordinate. Use this new coordinate to set the center of the map.


    http://rbrundritt.wordpress.com

    Friday, February 14, 2014 11:07 AM
  • Thanks Ricky

    Just what I needed, great.

    Best

    Ken

    Saturday, February 15, 2014 2:23 PM