From: Tomash B. <tom...@gm...> - 2013-10-25 23:43:21
|
Hello, When modelling mechanical instruments it's often desirable to provide a smooth needle transition when the input signal changes sharply. Some instruments not only have an ON/OFF switch, but also a knob to select an input source, and even when there's only one input property it itself may change the value sharply. XML-autopilot has a rate limiter, are there any gotchas of using it for needles (besides it being recomputed 120 times per second and not at a frame rate)? Currently in Tu154 to reduce the amount of Nasal computations at every frame we extensively use property aliases to either alias() needle property to a selected source, or to unalias() from any and set a constant value like "zero" directly. During such realiasing we have to inject smooth transition (in the case of a single input property changing sharply (where we can notice such event) we unalias() from it, perform smooth transition to the new value, and then alias() to the same property to track further (smooth) value changes without Nasal overhead). On top of that we can't use interpolate() because it takes only a constant as a target and can't interpolate to a target property that itself can change its value while transit is in progress, also interpolate() doesn't support periodic values like angles where you have to transit 359 to 1 through 0 and not via full turn (plus interpolate() doesn't play well with aliases: even with zero timeout it will store the final value sometime after Nasal finishes, so you can't switch alias on the same frame, otherwise the store from interpolate() will go to the wrong property). Solving all of this amounts to a very complex code (and it's sometimes simply impossible to notice sharp changes of a property itself). The life would be a lot easier if animation would support rate limiter of some kind (with period support). Or is XML-autopilot indeed the right solution for a problem? Will it be possible to connect <noise-spike> and <period>? -- Tomash Brechko |