GyroDroid - Access each and every sensor on Android devices [RELEASED]

Hi all,

Unity has built-in support for only some of the sensors on mobile devices.
This package provides access to every single sensor of your Android device. It can and has been used for augmented reality, multisensoric games, visualization and more. Sensors just work as expected, independent of device and app alignment and orientation.

The demo application (exactly the one contained in the package) is available from the Android Market (goo.gl/gkFq7).

Link to Asset Store:
http://u3d.as/2aR

Feature list of GyroDroid 5.2:

  • support for every single sensor Android is capable of:

  • Rotation Vector

  • Gyroscope

  • Accelerometer

  • Linear Acceleration

  • Gravity

  • Light

  • Proximity

  • Orientation

  • Pressure

  • Magnetic Field

  • Processor Temperature

  • Ambient Temperature

  • Relative Humidity

  • Magnetic Field (uncalibrated)

  • Gyroscope (uncalibrated)

  • Game Rotation Vector

  • Step Detector

  • Step Counter

  • Geomagnetic Rotation Vector

  • experimental support for iOS cross-compiling (so rotation just works the same on both platforms)

  • you can do pretty much everything the Android sensor API can do:

  • check whether sensor is available

  • activate/deactivate sensor

  • set fetching speed

  • get info about power usage, manufacturer etc.

  • … (see this link for a complete list of sensors and their attributes)

  • fallback handler for device rotation - if one sensor is not supported, the next best sensor is choosen

  • selectable rotation sensor technique (different combinations of sensors to achieve a complete, three-axis rotation value)

  • multiple demo scenes and samples for different usage scenarios

  • really easy to use (enable a sensor for your application = 2 lines of code, and that’s if you don’t want to use the provided prefabs)

  • supports Unity Remote 4 for debugging rotation sensors in the editor

There’s also a tutorial about how to use GyroDroid together with Qualcomm’s Vuforia augmented reality solution here.

You can try everything out in this demo scene (this complete application is included with the package, too):
Android Market (goo.gl/gkFq7) (simply type into your mobile’s browser to install the application, or install directly from market)

By default, GyroDroid sends sensor hardware statistics to help us improve it. You can easily opt-out of this completely by adding NO_GYRODROID_STATISTICS to your list of Platform Custom Defines under “Player Settings > Other Settings”, see the unity docs for more info.

The demo application features several useful example scenes:

  • camera as window (first person view)
  • rotating around an object (third person view)
  • explorable world (moving camera target), switch between first and third person view
  • rotation values relative to start rotation
  • linear acceleration
  • light sensor
  • device as a box
  • compass usage
  • statistics - overview over all sensors

Link to Asset Store:
http://u3d.as/2aR

Don’t forget to write a review once you bought it :).

Have fun and create cool things!
prefrontal cortex

Changelog for 5.2

  • added Unity 5 support
  • minor bug fixes

Changelog for 5.0:

  • added all current Android sensors:

  • Magnetic Field (uncalibrated)

  • Gyroscope (uncalibrated)

  • Game Rotation Vector

  • Step Detector

  • Step Counter

  • Geomagnetic Rotation Vector

  • multiplatform fixes for iOS/Android to accomodate for newer versions

  • added some buttons for manual screen rotation in demo scenes

  • added statistics framework to find out percentage values for real world sensor usage (you can opt-out, see ReadMe)

  • added support for Unity Remote 4 (for acceleration and rotation vector)

Changelog for 4.0:

  • Unity 4.2 broke GyroDroid due to internal changes, works again on Unity 4.x
  • added experimental iOS support (rotation, gyroscope, linear acceleration)
  • New sensor: ambient temperature
  • New sensor: relative humidity
  • added DeactivateRotation to SensorHelper
  • bigger font size for demo app and dpi-dependant scaling
  • bug fixes

Changelog for 3.1:

  • New example scene: Explorable World (touch-to-drag, change between first and third person camera, changing camera target)
  • New example scene: SuperDroid (uses rotation values relative to starting rotation)
  • added possibility to use a specific rotation sensor technique
  • correctly report first rotation value after initialization of sensors
  • Start menu with scrollbars and bigger buttons
  • fix: Linear Acceleration did not work on some devices (reminder: not available prior to Android 2.3)
  • fix: Statistics scene crash

Changelog for 2.5:

  • screen rotation fix for portrait devices (like Galaxy S2, Nexus S, …)
  • compass example scene
  • additional package for easier incorporation into your own project (so you don’t have to manually find all the files you need)
  • other modes than “Landscape Left” may be used for device orientation (even Auto).
  • linearAcceleration (not available prior to Android 2.3) always uses the right directions.

great work!
im on vacation, but was able to download the v2 demo on the galaxy tab and htc desire. unfortunately it crashes each time i select a category from the main menu. am i doing something wrong? firmware 2.2
thank you

Hey,

we weren’t aware that there are a few Android 2.3 calls inside our library (so the minimum required API level is currently 9 / Android 2.3.0). We will look into this issue as soon as possible - thanks for pointing this out!

Okay, so Android 2.3 introduced a bunch of sensors not available before. These sensors are, according to the SDK:

  • Gravity
  • Linear Acceleration
  • Rotation Vector

Unfortunately, these are the Really Cool Ones (the ones which work best and are most accurate).
The current application will crash running on Android 2.2 and below because of trying to access the regarding constants and functions — oops, that’s entirely our fault.

Be assured that the sensors available prior to Android 2.3 will work just fine in the next version of GyroDroid, shouldn’t take very long to correct that mistake.

The problem is fixed, and we updated the download link in the first post. The demo scene should work now down to Android 2.1, although Android 2.3 introduced more accurate sensors.

We tested on the following devices:

  • Samsung Galaxy Tab 7" - Android 2.2
  • Samsung Galaxy Tab 10.1v - Android 3.0
  • Motorola Xoom - Android 3.0
  • Samsung Google Nexus S - Android 2.3.3
  • Motorola Milestone - Android 2.2

Review is pending, so in a few days, the fixed version (2.1) is available in the Asset Store!

thanks a lot!
the demo works on the tab now.
what i need works perfectly, on the other hand:
the linear accel demo does nothing, maybe the tab + andro 22 doesnt support it
the box demo (awesome btw) works in all directions except one, check it out

very good work, thanks

If you open the StatisticsDemo on Galaxy Tab 7", you will see that LinearAcceleration sensor isn’t available (unfortunately, it was introduced with Android 2.3). Glad you like the other demos! Consider writing a review in the AssetStore, please :slight_smile: .

just tried the apk - this is pretty cool, and it’s neat that you have created an interface for all Android components!

Very cool! Although I think the camera is rotated 90degrees - - i.e. in the ‘camera window’ mode - moving the phone (galaxy s) up and down moves the camera up and down - but the camera is viewing everything 90 degrees sideways. Probably easy to sort out in Unity. Can’t wait to get stuck into this, thanks!

Hi pfc.

Good work! I have recently bought your plugin and so far I am happy with it.
But I have a problem. I cannot use it to look at the magnetic north.

Can you give a code example on how to achieve that please?

Thank you.

edit: nevermind, sorted this out. It was a unity thing.

Any chance on supporting GPS? I think from Unity 3.3+ onwards GPS is supported on Android using the iPhoneSettings class but not all functions mentioned in the Android SDK are implemented :frowning: So I was hoping you would…

I totally agree with janook!!.. GPS and Compass support would be GREAT for my upcomming project… any chance you´r asset will be supporting both in the near future, or in any future!?

Hey all,

sorry for the long time without answers - finally we’re back :slight_smile:
Compass is supported right now - you can simply use the MagneticField sensor (which basically is the compass included with the device). In the next version, we will also provide an example scene on how to use it, so it will be easier for you then.
We are also looking into fully supporting GPS, including all the features Android provides.
There are also some things to fix, like not-quite-right screen rotations on some devices.

I cannot give you a release date quite yet, but thanks for all your comments and requests!

Hi pfc! Very cool plugin, i just bought it a few minutes ago, i need it for this:

http://forum.unity3d.com/threads/110267-Accessing-sensors-of-Android-devices?p=731393#post731393

What sensors do you think i should use for that task? Thanks again, regards, Ilia.

Hi pfc.

I had problems with screen rotations on xperia mini and on samsung galaxy2.
Can you give a hint on how it can be sorted out?
Has it anything to do with the remapcoordinates() command from android?

gps support is welcome!

When will you make fixes for phones like Samsung Galaxy S2? I purchased the gyrodroid app and the axis are inverted. I really need this functionality because I need to complete a project in a month.

Hello all,

we just published version 2.5 of GyroDroid, should be available soon!

Change log:

  • screen rotation fix for portrait devices (like Galaxy S2, Nexus S, …)
  • compass example scene
  • additional package for easier incorporation into your own project (so you don’t have to manually find all the files you need)
  • other modes than “Landscape Left” may be used for device orientation (even Auto).
  • linearAcceleration (not available prior to Android 2.3) always uses the right directions.

We also updated the apk-file, so you can test the new version right now: goo.gl/oLkOQ

Have fun!
prefrontal cortex

Asset Store Link

PS.: We decided to implement GPS functionality into a new package, because of fundamental implementation differences and different requirements for your project (GPS needs manifest permissions, sensor usage does not). The GPS plugin isn’t ready yet, but we are working on it.

@vfxdomain:
Have a look at the TurntableRotation example. This is exactly the functionality you need - the horizon is fixed to the “real” horizon if you rotate the device. You only need to use the rotation values to steer your airplane.

I wonder what will be the difference from Unity’s android.location mapping and this plugin.
At the moment Unity’s locationInfo are working great, only timestamp seem to be broken.

Perhaps even a fix only on that side (the locationInfo.timestamp) would be enough to make willing to buy.

I have recently purchased GyroDroid and need some help regarding calculating relative rotation from a starting pose.

I am using the rotation as returned from SensorHelper. However, this only considers absolute rotation and sets the transform.rotation accordingly. Is there an in-built way of calculating rotation from a given starting pose? I.e. the position that the user is currently holding the phone.