Getting displacement from accelerometer data with Core Motion

前端 未结 4 1006
耶瑟儿~
耶瑟儿~ 2020-11-27 13:23

I am developing an augmented reality application that (at the moment) wants to display a simple cube on top of a surface, and be able to move in space (both rotating and dis

4条回答
  •  遥遥无期
    2020-11-27 13:42

    I am also trying to get displacement on the iPhone. Instead of using integration I used the basic physics formula of d = .5a * t^2 assuming an initial velocity of 0 (doesn't sound like you can assume initial velocity of 0). So far it seems to work quite well.

    My problem is that I'm using the deviceMotion.and the values are not correct. deviceMotion.gravity read near 0. Any ideas? - OK Fixed, apparently deviceMotion.gravity has a x, y, and z values. If you don't specify which you want you get back x (which should be near 0).

提交回复
热议问题