User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Accelerometer working in X but not so well in Y in Landscape mode?

  1. #1
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accelerometer working in X but not so well in Y in Landscape mode?

    Hello, I'm trying to use the Accelerometer object on my Android Phone.
    I've set it to Landscape, so I'm holding it in front of me like a steering wheel.
    When I rotate it left or right, like rotating a steering wheel I can get the object on my screen to move in X, left or right which is perfect!

    What I can't seem to do is get it moving up and down the screen in y very well by tilting the phone towards or away from me.

    I searched the forums and found the Accelerometer Fun example which is where I've got this from, the example supplied with that works in y but only when the phone starts flat as if on a table rather than held up like a steering wheel. I assumed I'd just have to recalibrate with it held in the new position but that doesn't seem to quite work, though it moves in y it drops quickly to the bottom of screen and doesn't really behave how I'd like.

    Any thoughts on what I might be missing?

    Thanks!

  2. #2
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Do you mean like this?
    https://play.google.com/store/apps/d...ingsAUCE&hl=en
    (Note one of my crappy games -- Does it run right on your device?)

    I'd have to see an example of what your going because I don't remember having to do anything special.

  3. #3
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Ah wait you want to move the object by moving the phone the other way.

    I think you need to use the Z data for that

    X is across
    Y is up and down
    Z is back and forth

    (I think some testing required)

  4. #4
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    See if this is what you wanted to do
    Attached files Attached files

  5. #5
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jeff, thanks for the help! Fun game, worked fine on my Nexus 5X although it took ages to "tap to play" as I thought it meant tap on the screen rather than tap on the plane

    Yeah that's pretty much what I'm after except I want to incorporate this with side to side movement as well.

    I used the accelerator fun example that was posted a while back.
    Accelerometer Attempts.mfa

    In the first frame I got great results tilting the phone side to side to move the object in X, it's nice and smooth.
    In the second frame I then tried to do the same thing in X but as you suggested in Z. The object just falls to the bottom of the screen and then that's it.

    Any ideas what I'm messing up?
    Here's the apk Accelerometer Attempts 001.apk

    Thanks!

  6. #6
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Opps playing more now.

    I think I was wrong about the Z


    I am still a little unsure what you want to do:

    Lets go over it:
    You have the app and phone landscape
    You tilt the phone like a steering wheel and the object moves side to side

    What is the other movement you want to do:
    Tilt the top of the phone towards/away from you and the object moves up and down?

  7. #7
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep app holding phone in landscape looking at screen.
    You tilt the phone like a steering wheel and the object moves side to side like in my first example.

    Then you tilt the top of the phone away from you, and towards you and it move up and down the screen in Y like your first example but in Landscape.
    So the extreme of this tilting away would be the phone's screen facing the ceiling, and the other extreme tipping it towards you would be facing the floor. But obviously not that much as you wouldn't be able to see the object on the screen moving up and down in Y

    Does that make sense?

  8. #8
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Does this one do it?

    I was talking to Fernando and it is a little odd but it was done like this to be the same as the iOS Accelerometer.


    Tilt like a steering wheel the object moves left/right
    Tilt the phone so the top is pointed towards or away from you and the object moves up and down.
    Attached files Attached files

  9. #9
    No Products Registered

    Join Date
    Oct 2015
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jeff, yeah this seems pretty cool actually.

    What was I doing incorrectly then?

    What is the Android Object for by the way?

  10. #10
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,825
    Mentioned
    8 Post(s)
    Tagged
    2 Thread(s)
    Android Object -- Just a special object to interact with features of the Android system.
    Take a look at its actions and it should be somewhat clear but you may need to read the help to determine what everything does.

    I forgot I put that object into the file above -- Its not doing anything in the example.
    I was just looking into the object to make sure there wasn't any Android specific accelerometer features in it.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Can't change the size of Leadbolt ads on Landscape mode
    By gamer123 in forum Android Export Module 2.5
    Replies: 16
    Last Post: 5th February 2015, 01:07 PM
  2. Problem with the Landscape mode on IOS 6
    By Diego in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 7th December 2012, 08:37 PM
  3. B13: Accelerometer values different to iOS in landscape mode
    By AndyH in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 25th January 2012, 11:59 PM
  4. Accelerometer does not work when landscape flips
    By AndyH in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 15th October 2011, 08:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •