Here's a patch to model.cxx that restores the proper rotation speed of
the propeller spin.

It just replaces the single 1/60000 constant with one that is
(hopefully) more clearly derivable from basic principles.  The
original number was off by a factor of 3/25; maybe something got
double-factored?  One thing I didn't do is grab the 120 Hz update rate
from a real source; it's hardcoded instead.  I forget where it comes
from.

For those wondering why I bothered working on this instead of the more
important stuff I'm supposed to be doing (flap drag bug in YASim
clickable virtual panel), I offer no excuse.  It was low-hanging
fruit, and my other stuff is hard.

Andy

diff -u -r1.10 model.cxx
--- model.cxx   20 Apr 2002 15:07:47 -0000      1.10
+++ model.cxx   30 Apr 2002 23:17:55 -0000
@@ -527,8 +527,9 @@
 void
 FG3DModel::SpinAnimation::update (int dt)
 {
-  float velocity_rpms = (_prop->getDoubleValue() * _factor / 60000.0);
-  _position_deg += (dt * velocity_rpms * 360);
+  float velocity_rpms = _prop->getDoubleValue() * _factor;
+  // 120Hz update, 60 sec/min, 360 degrees/revolution
+  _position_deg += (dt * (1/120.0) * (1/60.0) * velocity_rpms * 360);
   while (_position_deg < 0)
     _position_deg += 360.0;
   while (_position_deg >= 360.0)


-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to