Orientation d'une MAP avec le capteur d'orientation

Bonjour,
j'utilise un objet MAP.
je sais définir la position d'un marqueur et centrer la map sur sa position avec le capteur de localisation

je souhaite que lorsque le téléphone change d'orientation, la carte aussi change.
j'utilise donc le capteur d'orientation.
quand je pointe le téléphone au nord, la carte est ok.
quand je pointe le téléphone au sud, elle est ok aussi
quand je pointe le téléphone à l'ouest, l'orientation de la carte est inversée, j'ai sur la gauche le nord de la carte alors que la boussole de la carte montre bien le nord à droite...
et vice et versa pour l'est...

voilà le bloc tout simple:

image

est-ce que quelqu'un peut m'expliqer ce que je n'ai pas saisi?

merci d'avance et bonne journée

j'arrive à avoir un fonctionnement correct en faisant comme ça:

mais j'aimerais bien comprendre pourquoi je dois faire ça :slight_smile:

WELCOME YeYe.

This is a good question. I actually think your solution to get the Map turned based on how you 'point' the top of the device may not really be working. Sorry, I can't test the behavior on my tablet (which does not have an Orientation sensor).

1.) The Orientation Sensor provides an * Azimuth : 0 degree when the top of the device is pointing north, 90 degrees when it is pointing east, 180 degrees when it is pointing south, 270 degrees when it is pointing west, etc.. Map's Rotation specifies the rotation of the map in decimal degrees showing based on the numerical value sent to it provided you set EnableRotation to true. I cannot test what values your Orientation sensor is sending to it, but you can.

2.) Are you certain subtracting the Orientation from 360 degrees is really fixing your values? I expect that if your 'solution' works, it is because you need to provide a reciprocal azimuth to the rotation value or idiosyncrasies in how Rotation was designed. Providing the reciprocal is done by adding or subtracting 180 degrees; why 360 "works'=" in your app, I do not know. Are you testing outside, away from sources of magnetism (your computer monitor, magnets etc.). The orientation sensor does not point 'North'; it points to magnetic North which might be quite different. The Orientation sensor also points toward magnetic objects if their magnetic field is greater than the earth's magnetic field where you are located.

3.) Are you aware that not all Android's have an Orientation sensor? My Android 8.1 tablet does not. Google deprecated the Orientation sensor some time ago and most device manufacturers stopped supplying the hardware.

4). The Map component also has a Compass ; have you enabled it? ShowCompass specifies whether to display a compass overlay on the Map. The compass will rotate based on the device’s orientation if a digital compass is present in hardware.

Perhaps someone who has an Orientation sensor can test?

Thank you for your answer!
alors oui avec 360-azimut ça fonctionne très bien en fait.
simplement, ce capteur est vraiment très très sensible et donc la carte bouge tout le temps...
j'ai fait des tests en extérieur, en marchant c'est pas mal, mais en voiture là c'est trop sensible et donc inexploitable.
j'affiche bien le compas sur la carte et il bouge bien comme la carte, mais il est beaucoup moins sensible...
peut-être que je devrais filtrer les mesures et ne prendre que les 500ms... je vais essayer

autre piste: je vais essayer de prendre l'orientation sur un autre capteur...