0 Favourites

calibrate the tilt for level

  • hi guys...im 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?

    thansk

    Dan

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy 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)