Re: [Algorithms] mouse smoothing
Brought to you by:
vexxed72
|
From: Jon W. <jw...@gm...> - 2009-09-11 19:28:20
|
Jeff Russell wrote: > Survey Time: > > What is your preferred method for smoothing mouse input for a game > (for cases where the mouse is used to tilt and swivel a first person > or third person view)? "Too much" smoothing might be just trading > latency for smoothness, and too little might seem jerky, etc. What > algorithms do people like? > > Jeff To make this a little algorithms-relevant: Smoothing is like a filter for a signal. The signal is the delta mickeys (mouse ticks) per frame. The output is the amount to move the viewpoint. (The viewpoint itself is the integral of this signal). Personally, I've never used more than a single-pole first-order filter (a k a a "leaky integrator.") deltaMickeys = deltaMickeys * (1 - alpha) + newMickeys * alpha; heading = fmod(heading + deltaMickeys * Scale, TwoPi); Although perhaps you could treat the filter as a FIR (or even an IIR). Box-filtering as a FIR might work okay as long as you have a high sample/frame rate. Personally, I prefer "alpha' to be 1.0 in the above equation, though. The hardware already has inertia, so smoothing shouldn't be necessary, unless your frame rates are so low that control is a problem, and at that point, smoothing isn't the right solution... Sincerely, jw -- Revenge is the most pointless and damaging of human desires. |