Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Sajjoo · May 28, 2011 at 08:30 AM · iphoneaccelerometer

iPhone accelerometer values are not consistent

Hello guys, i am working on a bike game. i have a problem like if i put my iphone on a table in a static position still i can see its values are changing. its values are not consistent. can anybody tell me why is that so?

i,ll be very thankful.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Dreamblur · May 28, 2011 at 07:19 PM

The accelerometer reads all acceleration in units of g (earth's gravitational acceleration on relatively small object near its surface = -9.81 m/s). What that means is that it will read normal gravitational acceleration as 1.0 and any acceleration with a lesser or higher magnitude accordingly. Since all forms of gravity are constant (i.e., we don't float above the ground), that means the accelerometer will always read a downward acceleration even when the device is at rest. However, since the earth itself is moving and prolly from the accelerometer's method of measurement, the values received from that reading are not constant and will always change by a very small fraction. Regardless, the downward acceleration read when the device is at rest will always be very close to 1.0g. Also, since the earth is not completely flat, there is a very small angle of incline on the earth's surface which results in some gravitational acceleration also leaking to the x- and z- axes.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aldonaletto · May 28, 2011 at 07:38 PM 1
Share

You should also take in account that every practical sensor suffers from electrical noise and drift, so the values read will always show some inaccuracies. Define a limit - say, 0.05g - and only do anything when the changes are bigger than that. If you have to show the readings in a bar or display, you can do some sort of filtering. The moving media is easy to implement: keep the last 30 to 50 readings in a fixed size float array, and show its mean value (sum/array size). Each time you get a new reading, shift everybody one position towards the end of the array and store the new value in the first position.

avatar image CHPedersen · May 30, 2011 at 06:22 AM 1
Share

Adding to aldonaletto's comment, the datastructure should probably be a System.Collections.Generic.Queue, since it obeys the FIFO-behavior described there.

avatar image
0

Answer by Graham-Dunnett · May 28, 2011 at 06:34 PM

I don't think you should expect the numbers to be constant, even when the phone is not moving at all. How much variation are you seeing?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sajjoo · May 30, 2011 at 05:35 AM 0
Share

like 3 to 4 variations.

avatar image
0

Answer by dilmer · Sep 12, 2013 at 06:59 AM

Check out this control I wrote which may help you out.

Guys,

I worked in a game recently which needed an accelerometer control for a spaceship I created which is now available in the App Store as well, during my programming I found myself using this control for other games. I would recommended as is super easy to integrate into your game.

Download Now from the Asset Store

alt text

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Bag Toss Unity Accelerometer 1 Answer

A node in a childnode? 1 Answer

Unity iPhone - Camera Orthographic size - Differing results 1 Answer

iTween(JS version) could not be used in Unity iPhone? 3 Answers

Unity Penelope Tutorial and iPhone 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges