381
edits
Line 105: | Line 105: | ||
=== Did you know === | === Did you know === | ||
...that you can use expressions to create complex animations of objects in your 3d models or even drive them from multiple properties? | |||
Usually, an animation looks like this | |||
<syntaxhighlight lang="xml"> | |||
<animation> | |||
<type>translate</type> | |||
<property>foo/bar</property> | |||
[..]more elements[..] | |||
</animation> | |||
</syntaxhighlight> | |||
You can add a scaling factor or an offset to it, but that's basically all you can do that way. | |||
If you want to animate your object following a complex function, most people create complex Nasal scripts to compute the driving properties, probably not knowing that there is another way to achieve the goal: Expressions. | |||
Here is an example for a translate animation depending on two properties and the cosine function | |||
<syntaxhighlight lang="xml"> | |||
<animation> | |||
<type>translate</type> | |||
<expression> | |||
<product> | |||
<property>/my/factor-property</property> | |||
<cos> | |||
<deg2rad> | |||
<property>/my/angular-property</property> | |||
</deg2rad> | |||
</cos> | |||
</product> | |||
</expression> | |||
[..]more elements[..] | |||
</animation> | |||
</syntaxhighlight> | |||
A rich set of predefined functions is available, including almost all those you have on your scientific pocket calculator. | |||
[[Category:FlightGear Newsletter|2012 02]] | [[Category:FlightGear Newsletter|2012 02]] |