Is there another way we can utilize the Accelerometer?

Dell7730Dell7730 Member, PRO Posts: 388

I've created this game that uses it which let you play my game with no touch at all just the tilting, but is there a way we can use that to shake?

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    @mhedges said:
    If there were a way to calibrate the accelerometer upon app start . . .

    Just check to see what the current value of X,Y and Z are, then use these as the default position and offsetting any movement against these initial values.

Answers

  • Dell7730Dell7730 Member, PRO Posts: 388

    @jonmulcahy said:
    What do you mean shake?

    it means what it says, shake, lol..... like even when my phone is perfectly leveled, i can move my actor or actors by moving in any direction without tilting it.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    I still don't understand what you mean, if you phone is level, how will you tell the actor where to move without tilting / on screen controls?

    by shaking the device wouldn't you just be tilting really quick? if so you just flag an attribute in that direction and make the player move

  • Dell7730Dell7730 Member, PRO Posts: 388
    edited March 2015

    @jonmulcahy said:
    I still don't understand what you mean, if you phone is level, how will you tell the actor where to move without tilting / on screen controls?

    by shaking the device wouldn't you just be tilting really quick? if so you just flag an attribute in that direction and make the player move

    ok, imagine you're holding your phone upright facing you, and the actor is at the bottom of your screen, I would like that actor to jump up when I shake my phone up and down, no tilting, lol

  • mhedgesmhedges Raised on VCS Member Posts: 634

    Perhaps a timer activated upon movement detection in which, if several directions are detected before the timer expires, it recognizes a shake?

  • Dell7730Dell7730 Member, PRO Posts: 388

    @mhedges said:
    Perhaps a timer activated upon movement detection in which, if several directions are detected before the timer expires, it recognizes a shake?

    I tried that and nothing happens, lol... i guess the accelerometer checks itself for self leveling first before reacting to triggers, if it's not in a flat position, it's not activated, just a guess

  • mhedgesmhedges Raised on VCS Member Posts: 634

    @dellagarpo said:
    I tried that and nothing happens, lol... i guess the accelerometer checks itself for self leveling first before reacting to triggers, if it's not in a flat position, it's not activated, just a guess

    If there were a way to calibrate the accelerometer upon app start, perhaps it could be possible. For example, if you hold a phone in a landscape position, the phone will likely be tilted, and that position should be the "level". However, I haven't come up upon a thread yet that someone has successfully calibrated the accelerometer.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @mhedges said:
    If there were a way to calibrate the accelerometer upon app start, perhaps it could be possible. For example, if you hold a phone in a landscape position, the phone will likely be tilted, and that position should be the "level". However, I haven't come up upon a thread yet that someone has successfully calibrated the accelerometer.

    Back in 2009 I posted about calibrating the accelerometer, it's not too difficult, but you'll have to search to find it, it's from long ago.

  • mhedgesmhedges Raised on VCS Member Posts: 634

    @jonmulcahy , thanks. @dellagarpo , check this out!

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2015

    @dellagarpo said:
    i guess the accelerometer checks itself for self leveling first before reacting to triggers, if it's not in a flat position, it's not activated, just a guess

    The accelerometer just returns three values (X,Y,Z) depending on what angle the device is held at, there is no 'check for self levelling' (whatever that might mean).

Sign In or Register to comment.