|
hi , I'm trying to build a project which uses accelerometer as its input . I created a guitext to debug and see how my Nexus S accelerometer works . I wrote this : I'm trying to use the z value of accelerometer . I think the axis are y is in direction of phone's height , x in direction of phone's width and z is the vector coming out of screen . but holding the phone parallel to the floor and rotating it around it's z doesn't affect any of the accelerometer's values.
(comments are locked)
|
|
That's right. The only acceleration constantly acting over the accelerometer is the gravity. With the phone parallel to the floor, the whole gravity is applied opposite to the Z axis direction, thus it should show a value -1 (-1 G) while the other axes should be 0. Slowly rotating it to the upright position will move gravity from Z to the Y axis, and you should get Y = -1 and Z,X = 0 when completely vertical. thanks so much Aldo . the problem I'm facing now is that it seems gyro doesn't work with Android devices and Input.gyro.enabled seems to be always false . I tried to change the gravity with Physics.gravity = Vector3(0,0,1) but it seems that accelerometer works with real gravity not the scene gravity . I'll be appreciated if you've some other idea to make it work . thanks so much
Aug 08 '12 at 02:20 AM
smtabatabaie
Yes, the accelerometer axes are fixed, and Physics.gravity isn't taken into account. About the gyro, this thread ( http://forum.unity3d.com/threads/118786-android-gyroscope-in-unity-3.5-beta ) shows that other people are having problems with Android gyro in Unity - maybe it's not correctly implemented in Unity 3.5 versions yet. Have you tried to set Input.gyro.enabled to true? It seems that it's false by default in Android devices.
Aug 08 '12 at 12:18 PM
aldonaletto
thanks Aldo . yes I've tried to set to true but it seems to be always false . there's GyroDroid in asset store , I haven't tested it http://forum.unity3d.com/threads/101279-GyroDroid-2.0-Access-each-and-every-sensor-on-Android-devices-RELASED . thanks again Aldo
Aug 08 '12 at 02:54 PM
smtabatabaie
(comments are locked)
|
