- Home /
calibrate the accelerometer for different holding positions
Attempting to calibrate the accelerometers input to allow the user to set the neutral position of the control of the player e.g. user calibrate device at 45 degree angle to be neutral position opposed to the default 0 degree. I have achieved this by taking the new neutral positions center and subtracting that form the accelerometers input.
calibrate().... ....tiltxcalibration = Input.acceleration.x;
Update()..... ....Acceleration = Input.acceleration ....Acceleration.x -= tiltxcalibration;
The problem is that the new value is restricted in the total range. For example if the changed neutral is 45 degrees then Acceleration.x = 0 when Input.acceleration.x = 0.5 because of this calculation in update() "Acceleration.x -= tiltxcalibration". But this causes movement of the x access to be limited by (0.5) 0.5-1 compared to full (1) 0-1. This causes the player to move slowly in the upward direction when the input is calibrated.
Does anyone know a better way to calibrate the accelerometer for different holding positions / angles ?
Your answer
Follow this Question
Related Questions
How to make camera position relative to a specific target. 1 Answer
Detection of device fall 0 Answers
Toggle between Touch input and accelerometer 0 Answers
Unity3D cross-platform input wireless 1 Answer
Control left + right = up 0 Answers