Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 HypoXic5665 · Apr 02, 2013 at 08:30 AM · androidinputmathacceleration

Linearization of Android Acceleration Input

UPDATE If anyone is looking for a solution to this problem reference the forum post Reset Accelerometer? Is it possible? Tweaking and implementing this solution was much simpler than what I was attempting to accomplish in this post.

Hello fellow Uni-teers, I have a question for all of you math brainers out there. Let me preface this by saying that I probably slept through half of my math classes so if any of my concepts/vocab/understanding of the topic are incorrect, please be gentle :)

What I am trying to accomplish:

A simple control system where rotation of the device results in movement around the screen (X and Y only) within a preset confine. The players’ position is based on the delta input from their set default orientation meaning when the user returns the device to the default position, the character returns to the default position as well. (delta input = 1 means player position = 1, 0 = 0 and so forth) This control scheme is very much like the android game My Paper Plane.

What is working:

I have written a formula to convert the default android acceleration input (0 to +- 1 for every 90 degrees of rotation) to something that more suits my needs (0 to +- 2 for every 180 degrees of rotation) This allows me to easily save a default orientation and calculate the delta input from that orientation. This solution is working perfectly for me so far except for…

The problem:

The values that the android device feeds me are not linear. Rather, in a 360 degree cycle, they create a sin wave. This gradual falloff of perceived input (towards the +1/-1 end of the wave) is causing non uniform movement per degree of rotation and even dead spots! This is not conducive to what I want.

The data:

BLUE is a graph of rotation vs. acceleration input that the device currently gives along with the approximated data per 5 degrees of input for 180 degrees.

ORANGE This is what I need the graph to look like. Straight lines, uniform input per unit of rotation, a happy developer :D

alt text alt text

What I need:

I need to linearize the data from the android accelerometer (graph 1) to feed into my formula for conversion and movement.

The solution:

This one is for you guys… Please let me know if anything needs clarification or more information. Also if anyone has a simpler solution to create such movement, I am all ears :)

Thanks in advance,

Your friendly neighborhood Space Ninja

inputvaluesdata.png (46.3 kB)
360actualcombined.png (78.3 kB)
Comment
Add comment · Show 2
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 EvelBunny · Apr 02, 2013 at 06:45 PM 0
Share
  • for the well formatted question! Unfortunately I have no idea how to help you...

avatar image HypoXic5665 · Apr 03, 2013 at 06:06 PM 0
Share

Haha well thanks anyway Evel.

1 Reply

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

Answer by s_guy · Apr 03, 2013 at 06:21 PM

If your context allows you to treat this as a signal processing issue, you might look into

Fourier Series

and

a visualization...

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 HypoXic5665 · Apr 03, 2013 at 08:54 PM 0
Share

Thanks for the information. This looks very promising! I will take a closer look at it tonight and see how this might be implemented.

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android Acceleration Axis, not working with screen orientation? 0 Answers

Help with android shake intensity. 0 Answers

How to calibrate accelerometer according to start ? 1 Answer

screenCanDarken for Android (Backlight going dark) 1 Answer

Video player app button touch input working on android not on ios 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