• 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 /
  • Help Room /
avatar image
0
Question by Olpinski · Jul 07, 2020 at 03:02 PM · inputmobileaccelerometergyroscopeinput.acceleration

Does Input.acceleration use gyroscope?

Sorry if the similar topic was already discussed, but any searches including keywords "Input.Acceleration" and "Gyroscope" returns great amount of topics, but I couldn't find anything that is related to my question.

Does 'Input.acceleration' use Gyroscope on mobile devices? Name of the field suggest that it uses only accelerator, but I heard from friend (who is experienced Unity developer, but for Nintendo Switch, and haven't worked on mobile platforms for years) that this is actually using gyroscope underneath. As far as I read on the internet I believe this is using only accelerometer on mobile devices. But on the other hand, when I'm reading about functionality of accelerometer and I compare this to data I get from Input.acceleration I feel like it's returning more info than accelerometer alone can provide, so I am confused.

I would like also to ask is this good idea to publish game focused strictly on accelerometer control. I will implement alternative controls, but it can't be so intuitive and fun to play as those using accelerometer.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Dipity · Jul 07, 2020 at 07:10 PM

Input.acceleration only uses the accelerometer, you can disable the gyroscope in Unity using Input.gyro.enabled = false and Input.acceleration will still work.

I have build an App that uses Input.acceleration on smartphones that only have an accelerometer but no gyroscope and it works.

Input.gyro.attitude is the one that uses Accelerometer, Gyroscope and Compass (Magnetometer) for what is called sensor fusion.

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 Olpinski · Jul 08, 2020 at 02:00 AM 0
Share

Okay, thank you so much for your answer. I hoped the name of this property is accurate and it uses only accelerometer, but some articles about accelerometers really confused me, as it describes it as it's only returning force/acceleration of the phone and from my own experience it is perfect for reading current rotation of the device (I use it in my current project), so I was afraid I could use Gyro as well.

avatar image Dipity Olpinski · Jul 08, 2020 at 05:28 PM 0
Share

Those articles are right, the accelerometer measures the acceleration/force on the device. It makes use of earth gravity and depending on how you hold your device, earth's gravity will push on the three axes (x, y, z) with different gravitational force. Depending on the rotation that you need for your app, this can be enough.

If you put down your phone flat on a table, Input.acceleration will return ( 0.0, 0.0, -1.0). This means that earth's full gravity is pushing down on your phones z-axis. The value 1.0 means its the full earth gravity. Unity already converts the accelerometer raw values into values from -1.0f to 1.0f, so there is some $$anonymous$$ath happening in the background. When you now tilt your phone in different directions, earth's gravity will push with different amount on the three axis of your phone.

Smartphones use the accelerometer for example to detect wether they need to switch to landscape or portrait mode.

It takes a while to get your head around how the sensors work if you never worked with them ;)

avatar image
0

Answer by Olpinski · Jul 07, 2020 at 05:01 PM

Maybe anybody has phone without gyroscope and knows how Input.acceleration behaves on those devices.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

291 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Motion based Gesture recognition using accelerometer or gyroscope 1 Answer

Getting linear acceleration not using gyroscope on Android 2 Answers

Use quaternion(s) to rotate the accelerator reading 0 Answers

Problem with Android platform 0 Answers

the player input is jittery seems like glitching 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges