- Home /
Can you get the height that you are holding the phone?
relative to where it was before,
so like holding the phone up and then moving it back down to normal playing level and detecting that that happened?
or is magnitude with the accelerometer the best i could do
Answer by emc233 · Dec 25, 2013 at 08:40 PM
You can get the change in height from this physics mechanics equation :
Displacement= 1/2(acceleration)^2 (assuming device is at rest, zero initial velocity)
Because distance and acceleration are vector quantities you can determine the displacement in the a specific direction as well. For example get displacement in x direction:
Displacement in x direction = 1/2(acceleration in x direction)^2 (zero initial velocity)
that seems like what i want, sorry can you do an example with numbers to help with my dumb
Here is a link to the general stuff behind the equation: http://hyperphysics.phy-astr.gsu.edu/hbase/acons.html#c2
Displacement is the output of the function, or what you want. The magnitude of Displacement is distance. Acceleration is the input of the function and the output of the function that calls the internal accelerometer of the device.
Lets look at just displacement in the x direction, say the accelerometer reads "3" in the x direction.
Displacement in x direction = 1/2(3)^2 = 9/2
Answer by Lizakimlin · Nov 10, 2020 at 05:27 AM
@TimBorquez: hi..i'm trying to do the same thing..tracking smartphone height while user holding it...cn anyone help me with unity tutorial..or if you have link that similar...thank you