- Home /
Question by
crespoter · Mar 28, 2017 at 07:09 AM ·
unity 5mobileaccelerometer
Could you explain how the accelerometer calibration works
I have been following the space shooter tutorial and am confused with how the accelerometer calibration works . These are the 2 functions that was used
void CalibrateAccelerometer()
{
Vector3 accelerationSnapShot = Input.acceleration;
Quaternion rotateQuaternion = Quaternion.FromToRotation(new Vector3(0.0f, 0.0f, -1.0f), accelerationSnapShot);
calibrationQuaternion = Quaternion.Inverse(rotateQuaternion);
}
Vector3 FixAccleeration(Vector3 acceleration)
{
Vector3 fixedAcceleration = calibrationQuaternion * acceleration;
return fixedAcceleration
}
I am not able to understand how the accelerometer is calibrated with the above code .
Comment
Answer by SohailBukhari · Mar 28, 2017 at 07:36 AM
Using accelerometer axis change like seen in the image.
Here is the YouTube link for accelerometer, You will better understand calibration.
download.jpg
(6.2 kB)