Advanced Accelerometer Help

AppFueledAppFueled Member Posts: 308
edited April 2012 in Working with GS (Mac)
I followed T Shirt Booth's accelerometer tutorial. The game works great if you want to hold the iphone completely flat. But I would like to change the configuration so people who are sitting and holding the iphone at an angle (maybe 30 degrees) can also play the game.

Does anyone know what I need to change the numbers to?

For example, right now, each direction is: if the game.accelerometer is < (or >) -0.1 (or 0.1), So, what would I need the numbers to be?

THANKS!

Best Answer

  • scitunesscitunes Posts: 4,047
    Accepted Answer
    Here's what I do. Create a calibrate button or just use your start button on your main menu. Add the following code for a landscape game:

    change attribute game.Calibrate (real) to abs(game.accelerometer.X)

    Then in the tilt controlled actors do this:

    Any where that you have used game.accelerometer.X change it to this:

    (game.accelerometer.X+game.Calibrate)

Answers

  • AppFueledAppFueled Member Posts: 308
    Thanks, I will try it.
  • AppFueledAppFueled Member Posts: 308
    I tried what you said but I feel I may be doing something wrong. Where I have game.accelerometer.x > .1, I replaced .1 with (game.accelerometer.x+game.calibrate) but it didn't work. Does it look like I did something wrong?


    Here's what I do. Create a calibrate button or just use your start button on your main menu. Add the following code for a landscape game:

    change attribute game.Calibrate (real) to abs(game.accelerometer.X)

    Then in the tilt controlled actors do this:

    Any where that you have used game.accelerometer.X change it to this:

    (game.accelerometer.X+game.Calibrate)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    no dont replace the .1, replace the accelerometer.

    So when (game.acelerometer.X+game.calibrate) > 0.1
  • AppFueledAppFueled Member Posts: 308
    Thanks for the reply Jon.

    The problem I am having is that I can't get (game.acelerometer.X+game.calibrate) inside the field. It only allows me to select one attribute. When I try to add both, it just overwrites the other. If I try and write it in the field, it doesn't work. ???
    no dont replace the .1, replace the accelerometer.

    So when (game.acelerometer.X+game.calibrate) > 0.1
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make another attribute, constrain it to (game.accelerometer.X+game.calibrate) and use that attribute
  • AppFueledAppFueled Member Posts: 308
    Thanks again for your help John. I tried what you wrote and it worked.

    Is there any way to make the actor move when I slightly tilt the device. It seems that I need to tilt the device quite a bit for it to move forward or backward. ??? Thanks!
    make another attribute, constrain it to (game.accelerometer.X+game.calibrate) and use that attribute
  • AppFueledAppFueled Member Posts: 308
    never mind. I think I got it. Thanks again.
  • App SurgeApp Surge Member Posts: 651
    edited May 2012
    Change 0.1 to 0.01 or until it suits your needs.
  • AppFueledAppFueled Member Posts: 308
    I got it working but it doesn't matter if I choose .01 or .0001 for the accelerometer, I basically need to tilt it about the same to get it moving. Do you have any ideas?
    make another attribute, constrain it to (game.accelerometer.X+game.calibrate) and use that attribute
  • AppFueledAppFueled Member Posts: 308
    Still not working. I tried .1 and even .0001 and I still need to tilt it about the same to - either way - to get it moving...
    Change 0.1 to 0.01 or until it suits your needs.
  • AppFueledAppFueled Member Posts: 308
    When I calibrate the accelerometer, it doesn't matter what number I use ie., .1 or .00001, the sensitivity doesn't change. The calibration works great, I just can't make the accelerometer more sensitive. In fact, in order to move forward or backward, I have to tilt at least 30 degrees.

    I also tried without the calibration, and the sensitivity works just fine.

    Anyone have any ideas?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited May 2012
    I didnt really look threw all the comments on this thread on first, just helped you out with your second problem. Just read them all. Ive never used the method scitunes described for calibrate: change calibrate to abs(accelerometer.x)

    what ive always done is change calibrate to game.Accelerometer.X *-1

    Try that for your calibrate attribute, and see if you can adjust the sensitivity then. Might not make a differnce worth a shot though.
  • jckmcgrawjckmcgraw Member Posts: 647
    @8bitgrenade

    The 0.1 or 0.000000000001 won't make a diffference for the accelerometer being registered. It is the accelerate behavior amount in the rule that makes the difference.
Sign In or Register to comment.