Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by clliu

Hi Everyone,
Got a simple question on capturing accelerometer input. I saw there are couple of old post on how to get input from accelerometer. However in the document it says call ig.input.initAccelerometer(), then there should have values in ig.input.accel.x, ig.input.accel.y and ig.input.accel.z.
I tried this code by calling ig.input.initAccelerometer() in init() in main.js and try to get the x,y,z input in one of my entity updates, however it always is 0. Am I doing somthing wrong here? If you can supply some sample code that will be much helpful.

Thanks,
Louis

1 decade ago by clliu

Please give me a hand, this shouldn't be a hard problem at all.

1 decade ago by paulh

are you running it on a mobile with an acelerometer, such as an iphone?

1 decade ago by clliu

Yes, I tried on iPhone 4. I can only get x, y, and z with AppMobi.accelerometer.watchAcceleration(gameBusiness.AccOnSuccess, options); But not the ig.input.accel.x, ig.input.accel.y and ig.input.accel.z.
Page 1 of 1
« first « previous next › last »