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:
parent
617bc96c6a
commit
6f54ffc947
1 changed files with 9 additions and 1 deletions
|
@ -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() );
|
||||
|
|
Loading…
Add table
Reference in a new issue