I would like to implement some kind of filter that makes the movements of my object “smoother”.
Let me explain
I have a big 3D object in my scene, and I catch it with my hand (tracked by a tracking device) by making this object child of the hand component. The thing is that the tracking is not perfect so the hand is shaky therefore the object shakes.
I have been looking for a solution to fix this shaking, like moving the object only when the movement of the hand is big enough but I don’t really like it and I wonder if there is something better.
If you guys have some idea on how to do that I would appreciate any help
Thank you very much
Use a first-order filter, maybe? Force the hand object toward the target with a magnitude proportional to the distance between the current and target position. Add clamping for max force/speed.
Actually, you could probably just use a Vector3.SmoothDamp() (or the Vector2 version if appropriate) instead, it should reduce the jittering.
I had the same exact problem some time ago using Kinect. The solution that best worked for me was taking the average of the most recent n values. I used a Queue for keeping the latest 6-8 values (IIRC) and the final position was the average of them.
Thank you for the answers.
I also thought of using a Queue and use the mean of the n latest value.
It is not done yet but I appreciate the help !
I will let you how it goes in the future.