User Tag List

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

Thread: Accelerometer Question?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accelerometer Question?

    Hi, I am trying to make the an object move right to left when you tilt the phone to its sides using the accelerometer. Does anyone know how to do this; if so how?
    Here Is a video I found showing you what I would like to do: https://www.youtube.com/watch?v=pt90R6URUu4
    In the video The space ship moves right to left when you tilt the phone, That is what I am trying to do.
    Thanks in advance!

  2. #2
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleMac Export Module
    AndyH's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,445
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Two ways it can be done. The first is assign a movement to your spaceship (eg: 8-way with only left/right directions enabled). Then under the iOS Frame properties set the joystick - device to accelerometer. The tilt should move the object left and right.

    The second way is to add the accelerometer object to the frame and read the x, y and z acceleration (angles) to determine how you move the spaceship. This affords you complete control so you can adjust the behaviour exactly as you need it but requires you to do all of the work.
    Andy H @ ovine.net
    Awful Jokes - a new cartoon every day: http://awful.ovine.net/
    Ovine's games: http://www.ovine.net

  3. #3
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleMac Export Module
    AndyH's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,445
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I think I have discovered a bug (at least on Android - will test on iOS later) with the accelerometer joystick. Have posted it on the bug tracker. The Accelerometer works ok, although I think it shares a different bug (also reported) based upon the orientation setting for the application.

    In any case, take a look at the bug report and download the attachment at the bottom. This shows how to use the accelerometer object to move the active object left and right.
    Andy H @ ovine.net
    Awful Jokes - a new cartoon every day: http://awful.ovine.net/
    Ovine's games: http://www.ovine.net

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The movement that you showed me is great but it is vertical. I would like to have it horizontal if possible please.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleMac Export Module
    AndyH's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,445
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Did you test it on iOS? I think this is a bug that has been reported. To make it work, try editing the action:

    X( "Controlled by events" ) + ( XGravity( "Accelerometer object" ) * 10.0 )

    to be

    X( "Controlled by events" ) + ( YGravity( "Accelerometer object" ) * 10.0 )

    That might solve the problem for now.
    Andy H @ ovine.net
    Awful Jokes - a new cartoon every day: http://awful.ovine.net/
    Ovine's games: http://www.ovine.net

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I did that and tested it, It did not move at all.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How can this be fixed?

  8. #8
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleMac Export Module
    AndyH's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,445
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    When you say it still move vertical, had you set the device orientation to portrait or landscape - and was the object moving up or down or did you have to tilt the device up and down?

    Sorry not been able to test on my Apple yet so I'm making some guesses. On Android which I can test a little more quickly at the moment, there is a small bug to resolve that is causing some problems and its possible this might be the case on iOS too. Clickteam are currently looking at resolving the issus, they are pretty speedy at releasing patches.

    So you made the change X( "Controlled by events" ) + ( YGravity( "Accelerometer object" ) * 10.0 ) and it didn't move at all? Did you try tilting the device in other directions? Perhaps YGravity is the wrong one? There are X, Y and Z angles that the accelerometer can report, so you could try ZGravity instead of X or YGravity?

    It might help to get your bearings by making a little test program. In your test program make three different counter objects and position them on screen. Add an Accelerometer object.
    Now create an ALWAYS event. Give it three actions:-
    1) Set Counter 1 =
    XGravity( "Accelerometer object" )
    2) Set Counter 2 = YGravity( "Accelerometer object" )
    3) Set Counter 3 = ZGravity( "Accelerometer object" )

    If you set up the above event correctly, when run on your apple device you should see values shown in the counters on screen ranging from -1.0 to +1.0. This will give you an idea what values are being reported when you tilt the device in different directions.

    In my example MFA file the first active object is being moved on it's X-axis based upon one of the Gravity values of the accelerometer. ie: I'm setting it's X position to be it's current X position + the gravity value (this is the -1.0 to +1.0 value) times by 10.0 (so the value will be from -10.0 to +10.0 and will move faster). Just make sure in your iOS application settings you have set the orientation to what you want to work in (portrait or landscape mode).

    Let me know how you get on, and please bear in mind there could be some issues related to the Android version that Clickteam are looking into at the moment so there might be some changes in the next version. You can use the test program you make to check the values returned in the three counters again
    Andy H @ ovine.net
    Awful Jokes - a new cartoon every day: http://awful.ovine.net/
    Ovine's games: http://www.ovine.net

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The YGravity Worked; I didn't change the set Counter to (YGravity. Thanks! BTW is it possible to make the object move faster when you tilt the phone if so how? because it seams to be moving slow on my phone but not extremely slow, I would just love it if it could go a little more faster. Thanks!

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    UnicornMan's Avatar
    Join Date
    Aug 2013
    Location
    California
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvm I found out how Thanks Again!

Page 1 of 2 1 2 LastLast

Similar Threads

  1. "Accelerometer Example" Question
    By xhedgehogx in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 6th September 2013, 08:20 PM
  2. Accelerometer joystick?
    By MattEsch in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 30th June 2012, 04:25 PM
  3. Someone can help me with the Accelerometer please!
    By Koji_Kabuto in forum iOS Export Module Version 2.0
    Replies: 5
    Last Post: 3rd February 2012, 11:07 PM
  4. Accelerometer & Animation
    By voyt3kduv in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th December 2011, 04:33 PM
  5. BUG: Accelerometer joystick
    By happygreenfrog in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 16th September 2011, 11:46 PM

Posting Permissions

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