How to get motion control values from iPad ?

0 favourites
  • 12 posts
From the Asset Store
Complete the collection by purchasing Motion Universe Pt. 2
  • I'm new in Construct 2 and try to make a motion control on iPad.

    I Use some actions to get values on every tick, and show them as text on the screen.

    As the test I can get the "Touch.AccelerationXWithG" value on my iPad.

    but the "Touch.AccelerationY" and "Touch.Alpha" seems didn't work.

    Do I got something wrong ? How can I get those montion values ?

  • Answer myself.

    I make a test for 3 group of values.

    1.Direction

    2.Acceleration

    3.Acceleration with gravity

    On HTC HERO with android 2.1 got nothing.

    On HTC Desire with android 2.2 got nothing ,too.

    On iPad 1 (with iOS 4.3.1) got only the 3.

    But on iPhone 4 (with iOS 5) all of them works well.

    I think maybe I should upgrade my iPad and try again.:)

  • It depends on the browser and phone hardware - like you've done you just need to play with different devices and see which values work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On iPad 1 (with iOS 5.1) got only the 3.

    Seems iPad 1 cant make direction control with Construct 2 r69 .

    I just met Construct 2 two Days before and feel it's a great tool making thinkings into a game quickly and easily , thanks for doing the great job!

    But

    by now I think not to use it making games with motion control , maybe put a hope to the later version :)

  • Hi Hayato,

    Could you add a capx file of your findings?

    I'm currently working on motion controls for the iPad 1st gen and am yet to be successful.

  • All : remember that the iPad 1 has no gyroscope inside. So you can only get acceleration reading, no direction/heading...

    With acceleration, you need to integrate (mathematically) that information two times to get position, and even that way, it's very innacurate.

  • I cant upload my capx to dropbox by this PC now , but there is my test page :

    http://dl.dropbox.com/u/12420207/M2/index.html

    By using it we can define your device if it may support those values or not quickly.

    In some case , device cannot get any value in offical web browser , but get values in 3rd-party web browsers, for example the SE Xperia Arc.

  • This test is preety usefull:

    Actually I'm also interested on a capx file of the test you posted here(if at all possible when youre able). It shows some interesting values on my iphone 3gs and some nice movement that I'd like to take a more detained look at. I'm trying to make a shooter that should combine accelerometer valeues and swipe for certain movements.

  • Hi Hayato,

    I'm also interested in seeing the capx. Or if you don't want to do that would you mind just typing down the commands you used? I can't seem to find any examples on the 'touch.acceleration' controls.

  • Sorry for reply late , I have forget to login here for a long time.

    Now I have use the latest version (r87) of Construct 2 and make some upgrade for the sample :

    http://dl.dropbox.com/u/12420207/C2/Motion2/index.html

    or access by QR code

    <img src="http://dl.dropbox.com/u/12420207/C2/Motion2/QR_Motion2.png" border="0">

    And you can get the capx here:

    http://dl.dropbox.com/u/12420207/C2/Motion2/Motion2.capx

    Hope those files are helpful for you :)

  • hayato, I signed up on these forums just so I could say thank you! I was wondering how I could use the accelerometer in my driving game but never knew how to get the Touch.Accelerometer variables. Thanks for showing me how to do it! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Also, I've been wondering how I could calibrate the accelerometer because people hold their devices in varying ways. My AccelerationYwithG doesn't need to be calibrated, but my XwithG does.

    I've tried storing a global variable called AccelXCali set to XwithG at start, then adjusting my comparisons according to that value, but I get weird values for AccelXCali. Sometimes it's 0.9..., others it's 0, and once it was like 300k. Obviously not much of a calibration. Am I checking the accelerometer too early?

    Thanks!

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