Re: mouse smoothing

Jon Watte <[email protected]>
Newsgroups gmane.games.devel.algorithms
Message-ID <[email protected]>
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.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.