I have confused a little bit. Please help me . I wrote this code .And I am getting distX,distY and distZ .Now I want the final distance using these three.
-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
velX += (acceleration.x * intervalDate);
distX += (velX * intervalDate);
velY += (acceleration.y * intervalDate);
distY += (velY * intervalDate);
velZ += (acceleration.z * intervalDate);
distZ += (velZ * intervalDate);
}
Easy...
distance = sqrt( distX*distX + distY*distY + distZ*distZ );
Good luck.
Best, Peter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With