1
0
Fork 0

Allow easing of setting the time-offset

Configurable with properties:

/sim/time/warp-easing == false ? jump to new time offset (orig. behaviour)
/sim/time/warp-easing == true ? use easing parameter to adjust warp

/sim/time/warp-easing-duration-secs: time in seconds to reach the new value
/sim/time/warp-easing-method: easing method to apply. default: swing
This commit is contained in:
Torsten Dreyer 2014-12-17 09:45:59 +01:00
parent 617bc96c6a
commit 6f54ffc947

View file

@ -372,7 +372,15 @@ void TimeManager::setTimeOffset(const std::string& offset_type, long int offset)
warp = 0;
}
_warp->setIntValue( orig_warp + warp );
if( fgGetBool("/sim/time/warp-easing", false) ) {
double duration = fgGetDouble("/sim/time/warp-easing-duration-secs", 5.0 );
const string easing = fgGetString("/sim/time/warp-easing-method", "swing" );
SGPropertyNode n;
n.setDoubleValue( orig_warp + warp );
_warp->interpolate( "numeric", n, duration, easing );
} else {
_warp->setIntValue( orig_warp + warp );
}
SG_LOG( SG_GENERAL, SG_INFO, "After TimeManager::setTimeOffset(): warp = "
<< _warp->getIntValue() );