Hi,
I have hiking app with compass function. I was correcting some problems with location and after fix it, I noticed that compass is not working properly anymore.
As I could not find any error in blocks (not first time to reblock something by accident) I tried Taifuns compass.aia and bearing.aia. But the problem was still there:
ImageSprite is not moving around it center point, instead it is moving outside of the canvas/screen edge like it is moving around some point outside of the screen.
Then I installed some random compass app from Google Play and behavior of compass was ok. Also I checked and calibrated built-in compass (i have Samsung Galaxy S22) and it is ok as well.
Pls let me know where could be the error? As I said, before recent update of my app compass was working ok.
ABG is right. The Sprite rotates around (0,0), which is the bottom-left corner. Set OriginX and OriginY to half of the width and height values of the Canvas.
thx for your kind help which helped me to solve the problem described.
But then another one appeard. I had problem to center ImageSprite. In Taifuns app they sticked to top part of canvas and in my app to the left part of canvas.
I think I found a solution with using following formula:
Then I check documentation and it says:
OriginX
Horizontal unit coordinate of the origin with respect to left edge. Permitted values in [0, 1]. A value of 0.0 means the origin lies on the left edge, 0.5 means the origin lies in the middle and 1.0 means the origin is on the right edge.
OriginY
Vertical unit coordinate of the origin with respect to top edge. Permitted values in [0, 1]. A value of 0.0 means the origin lies on the top edge, 0.5 means the origin lies in the middle and 1.0 means the origin is on the bottom edge
X
The horizontal coordinate of the origin of the ImageSprite, increasing as the ImageSprite moves right.
Y
The vertical coordinate of the origin of the ImageSprite, increasing as the ImageSprite moves down.
Is it possible that since inclusion of OriginX/OriginY setup of canvas/imagessprite is different as before?
or I am making mistake that negates my mistake?