Sign in to follow this  
n4gix

XML Animations in Models & Gauge Control (redux)

Recommended Posts

Jean-Luc asked in another thread:>Hi Bill,>>so for loop, I understand FS jumps to the next frame of the>animation at 18Hz (hence 1024/18 ~= 57). Is this supposed to>be time based in FSX instead of tick18?According to what we "heard," tick18 has supposedly been eliminated in FSX, but... it still works! Obviously so, otherwise all FS9 compliant models would be 'broken...' :)>As for other animations, there is no "18Hz" constraint isn't>it? you just set the L: Var as fast as you can and the model>will jump to the frame you would index directly with the L:>Var (well, you can do math but to stick to simple examples,>var from 0 to 1010 for frames from 0 to 1010). Now, if you>want to transition from 0 to 1010 at the FPS the model is>displayed (i.e. actual FS FPS), you would need to update the>L: Var at the same speed (impossible from a gauge limited to>18Hz update cycle, so you can use min/max values only, like>with a BOOL example, and use LAG parameter to let FS>interpolate itself overtime isn't it?Without the new SDK, I cannot offer much comment on the "new FSX" approach yet... ;)To summarize, there are at least two possible approaches to animations using FS9's methods (periods inserted to preserve indents):FS Variable Based..........................................SPOILERS HANDLE POSITION...............percent........................200...............Using "stock FS token vars," the following is how the tags are interpreted:SIM: Converts simvar to keyframes: simvar * scale + bias = keyframesNote that in the above example, the "units" are percent, thus simvar = 100, thus keyframes = 100 as well. No "scale" or "bias" is needed to "pump up" the value returned. For a boolean return, one would use a scale = 100, or perhaps scale = 50, bias = 50, depending on the final outcome desired.Custom L:variable Animation........................50 (L:FuelKnob,enum) 50 * + ............100 ...............The above code is for a "four position fuel knob" that animates the sequence: OFF LEFT RIGHT OFFThe keyframes are: 0, 50, 100, 150The L:variable range sequence is: -1, 0, 1, 2Using the math in the code line produces the following output:(L:FuelKnob,enum * 50) + 50(-1 * 50) + 50 = 0(0 * 50) + 50 = 50(1 * 50) + 50 = 100(2 * 50) + 50 = 150As before, the parameter of 200 will cause the animation to smoothly, but quickly rotate to the new position. The L:var may be driven by either an XML gauge or a C gauge, whichever is more convenient. ;)Alternatively, one could use the following example, and "drive" the animation & speed directly from the controlling gauge:........................(L:FuelKnob,enum) ...............In this case, the programmer must ensure that his/her code will provide the needed range of 0 to 150, as well as the appropriate "stop points."

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this