Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Gideros 2019.12 released - Page 3 - Gideros Forum

Gideros 2019.12 released

13»

Comments

  • olegoleg Member
    hgy29 said:


    3° Changing it to (atan2(x,y)+180°) as suggested by @oleg gives incorrect results

    I'm not suggesting the formula you indicated
    magneticHeading = (math.atan2(fx, fy) + math.pi) * (180 / math.pi);
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • hgy29hgy29 Maintainer
    @oleg, that's what I wrote, except that I reasonned in degrees and not in radians (and assuming my atan2 includes the conversion to degrees)
  • olegoleg Member
    @hgy29
    ps//
    My formula shows the correct results even without the calibration of the magnetic sensors, the compasses available in the store without the calibration show the wrong result
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • hgy29hgy29 Maintainer
    edited January 8
    oleg said:

    @hgy29
    ps//
    My formula shows the correct results even without the calibration of the magnetic sensors, the compasses available in the store without the calibration show the wrong result

    I do get what you say, but lets face it: if apps on the store gives incorrect results for you, then it is probably your phone that has a non commonly placed sensor... I don't want to offend, but do you have another phone to check ?
  • olegoleg Member
    hgy29 said:

    oleg said:

    @hgy29
    ps//
    My formula shows the correct results even without the calibration of the magnetic sensors, the compasses available in the store without the calibration show the wrong result

    I do get what you say, but lets face it: if apps on the store gives incorrect results for you, then it is probably your phone that has a non commonly placed sensor... I don't want to offend, but do you have another phone to check ?
    I checked on 5 devices

    The apps in the store give the right result, but before using the apps you need to rotate the phone to calibrate the sensor

    I have a tablet from google, I doubt that the sensor is non-standard

    I also checked on third-party devices (samsung,lg)- everything works the same

    On the phone from lenovo - does not work because there are no magnetic sensors there
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • SinisterSoftSinisterSoft Maintainer
    edited January 8
    I checked the Gideros compass example code against the 'built-in' Samsung app on my phone - same results. BUT, if I put the phone vertical the Samsung app stays accurate but the Gideros app flips 180 degrees.

    (this has apparently been fixed in a newer version of Gideros, will be able to check tomorrow I think when @hgy29 gives me the apk).

    Likes: MoKaLux

    +1 -1 (+1 / -0 ) Share on Facebook
  • olegoleg Member
    edited January 8

    I checked the Gideros compass example code against the 'built-in' Samsung app on my phone - same results. BUT, if I put the phone vertical the Samsung app stays accurate but the Gideros app flips 180 degrees.

    (this has apparently been fixed in a newer version of Gideros, will be able to check tomorrow I think when @hgy29 gives me the apk).

    in the example of gyderos there are 2 errors

    Replace the example code with this one and check on the player with the screen rotate automatically
    Be sure to turn off GPS
    application:setKeepAwake(true)
     
    function content() -- реальні розміри видимого екрана scrX центр centrX, і координати видимості сторін minX
    	minX,minY,maxX,maxY=application:getLogicalBounds()
    	minY=minY--+200 --1
    	maxY=maxY---200 --1
    	centrX =application:getContentWidth()/2
    	centrY =application:getContentHeight()/2
    	scrX=(minX-maxX)*-1
    	scrY=(minY-maxY)*-1
     
     
    end
    content()
    ------------------------------------------------------------------
    local arr2=Bitmap.new(Texture.new("compass-pointer.png"))
    	arr2:setAnchorPoint(0.5,0.5)
    	arr2:setPosition(centrX,centrY)
    	stage:addChild(arr2)
    	-----------------------------------------------------
    geolocation = Geolocation.new()
    local function onHeadingUpdate(event)
     
    	--print(math.floor(event.magneticX),math.floor(event.magneticY),math.floor(event.magneticZ))
    	fx=event.magneticX
    	fy=event.magneticY
    	fz=event.magneticZ
     
    	 magneticHeading = (math.atan2(fx, fy) + math.pi) * (180 / math.pi);
     
    	arr2:setRotation(magneticHeading)
    end
     
    geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
    geolocation:startUpdatingHeading(magneticHeading)
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • SinisterSoftSinisterSoft Maintainer
    @oleg I'll do that if the new apk given by @hgy29 doesn't work - downloading it this morning.

    Likes: oleg

    +1 -1 (+1 / -0 ) Share on Facebook
  • olegoleg Member
    edited January 9

    @oleg I'll do that if the new apk given by @hgy29 doesn't work - downloading it this morning.

    Also if it is not difficult for you, check to compare these 3 formulas on your device
    fx=event.magneticX
    	fy=event.magneticY
    	fz=event.magneticZ
     
    	 magneticHeading = (math.atan2(fx, fy) + math.pi) * (180 / math.pi);
    	 magneticHeading2 = (math.atan2(fx, fy)) * (180 / math.pi);
    magneticHeading3 = (math.atan2(fx, -fy) + math.pi) * (180 / math.pi);

    I plan to use the compass as a joystick along with an accelerometer. So GPS is not suitable for me, but I need stable determination of the deviation of the phone from the magnetic pole.
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
Sign In or Register to comment.