Accelerometer z axis problem

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 :

function Update()
 var phoneX = Input.acceleration.x ;
 var phoneY = Input.acceleration.y ;
 var phoneZ = Input.acceleration.z ;
 guiText.text = "phoneX : " + phoneX +

phoneY : " + phoneY +
phoneZ : " + phoneZ;

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.

I’ll be appreciated if someone can help me with this


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.

Maybe you’re confusing accelerometer with gyroscope - a gyroscope can track rotations, while the accelerometer only reports the result of forces acting on the phone - usually fast movements (shaking, hitting, etc.)