calibrate the tilt for level

0 favourites
  • 4 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • hi trying to figure out what the math should be to calibrate one axis to "level".

    lets say the error in the measurement is 2 degrees....andi have a surface that is unknown levelness....

    if i take a touch beta measurement on that surface, then rotate the phone 180 degrees and take a second measurement, i get the error shouldwork out to be :

    error = (measurement1+measurement2)/2    

    then subract the error from the touchb.beta and you should have the anglular measurement relative to actual level.

    but its not working for some reason and im not sure why

    any ideas?



  • Looks like you'll need some trigonometry. The three Trigonometric functions are sine, cosine and tangent. In C2 their system expressions are cos, sin , tan // for inverse: acos , asin , atan .

    I'm in the process of trying to set the accelerometer's zero point to the users phone's position/angle he is holding it on start of layout. There's alot of trial & error involved but the purpose of it is to allow the player to play the game without compromise to the how they want to hold the phone to control their player since my game is 8 direction tilt based.

    Try working with Touch.Acceleration expressions and comparing two values. You can also create a variable & subtract from that every time the player moves.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe this topic will help you

    I don't think there is any need for trigonometry, but one can make it as hard as one wants.

  • #Facts

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