- Home /
Gyroscope smooth transitions (minimizing jerk from tiny movements)
Is there a way to set a minimum threshhold for which the gyroscope input will be recorded?
This is to try minimizing tiny vibrations and jerky motion from disturbing a camera controlled by the gyro.
You can try to smooth input by using Lerp.
float fPreviousInput;
// ...
fNewInput = $$anonymous$$athf.Lerp( fPreviousInput, fNewInput, Time.deltaTime );
that makes the motion appear "slow motion"... is there a way to also maintain accuracy or avoid the slowmotion effect?
$$anonymous$$ryptos, why do you post answers as comments?
@paulius-liekis I do so when I'm not sure of my answer or when I think it is incomplete.
In this case, I think this is just a hint but not a complete answer.
Fair enough, but your answer might be sufficient for person who is asking and he won't be able to mark is as correct.
Answer by Paulius-Liekis · May 03, 2012 at 07:22 AM
Some people use Kalman filters, but I find that overcomplicated - simple Lerps are good enough.
People do adaptive filtering: if new value hasn't changed a lot from previous, then you lerp it a lot with previous, if it changed a lot, then you lerp just a little bit. In such case tiny movement are suppressed, but you still get big movements.
All these methods basically "blur" your data and if you blur too much, then it looks like input is delayed. It's a tradeof between jerkines and delay.
@ina To reduce the effect of slowing down, you can use a multiplier inside the Lerp:
fNewInput = $$anonymous$$athf.Lerp( fPreviousInput, fNewInput, fDamping*Time.deltaTime );
The value of fDamping
will depend on your experience with it. Try large values first, close to your game FPS (e.g. 60, 30) then decrease it until you reach a good compromise.
Your answer
Follow this Question
Related Questions
Gyroscope Orbit Android 1 Answer
Phone camera autofocus 0 Answers
Smooth Follow Camera Rotate on Z-Axis? 2 Answers
Gyroscope Tilting Rotation. Quaternions T_T Help. 1 Answer
How do I access CoreMotion and the Android equivalent? 0 Answers