Getting north (absolute) compass value?

  • Hi,

    I use cordova-plugin-device-orientation in C2 runtime to get north compass orientation, I want to switch to C3 runtime but cordova plugins are not yet all supported. So I ask if the new Touch plugin in C3 runtime is supporting Magnetic absolute compass orientation ?

    If not, is there any way to get magnetic orientation value in C3 runtime?

    I learned long ago from this link:

    developerdrive.com/how-to-use-the-device-orientation-api

    That I can implement javascript to my project to get absolute compass heading, but I'm not a javascript programmer and I don't know how to implement it in C3, so an example would be very much appreciated.

    Thanks

  • It's already supported by the official Touch plugin. As documented in the manual:

    Alpha is the compass direction in degrees.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's already supported by the official Touch plugin. As documented in the manual:

    > Alpha is the compass direction in degrees.

    Thanks Ashley for your reply.

    I know Touch plugin already returns compass direction since C2, but it returns only gyroscopic heading not true heading from north direction (magnetic north).

    I just tried to compile an apk from last C3 r195, and tested this:

    Each time I restart my app I get different value for Alpha, for same direction from the magnetic north.

    Maybe checking this link may explain exactly what I mean: w3.org/TR/orientation-event

    4.2. deviceorientationabsolute Event And 4.3. compassneedscalibration Event

    When I use cordova-plugin-device-orientation I can get abolute magneticHeading not gyroscopic heading.

    I compiled some app on android and iOS, it happends sometime when I prompt the watch heading command, that the phone ask for calibrating the compass.

    If Touch plugin is not yet supporting absolute compass direction, I hope if there is any way adding cordova-plugin-device-orientation to C3 runtime, because I really need it for my project.

    Thanks again for your reply.

  • I think all I have to do is just wait and keep my project on C2 till the day cordova-plugin-device-orientation is ported to C3 runtime.

    Thanks anyway.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)