Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Calculating distance travelled by device in up and down direction (y axis)

Discussion in 'AR/VR (XR) Discussion' started by uniLogix, Aug 29, 2018.

  1. uniLogix

    uniLogix

    Joined:
    May 24, 2015
    Posts:
    12
    Im working on an app feature to calculate distance travelled by device in upward or downward direction. On the base of distance I can count workout done by a person. Is there anyone who can guide me the right way to do it.
    I do want to know if it is possible through Acceleration.y ?
    Is there any thing related to gyrometer that can be used rather than accelerometer?

    Im not interested in doing through AR or VR.
    Thank you
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I don't think the gyro helps you — that measures rotation, not displacement.

    So the accelerometer is the right way to do it. Record some accelerometer streams to files as you do the exercises, look at them (all three values — x, y, and z) in a spreadsheet, and see what you've got. Keep in mind that the user may not be holding their phone in any particular orientation, so you'll need to look at the combination of x, y, and z.
     
    uniLogix likes this.
  3. uniLogix

    uniLogix

    Joined:
    May 24, 2015
    Posts:
    12

    im planning to put mobile phone on back of user while doing pushup workout, or binding to arm. Which way suits.
    Thank you though for directing me. I will surely give it the try.
     
    JoeStrout likes this.