Howto:Animate models: Difference between revisions

Jump to navigation Jump to search
m
Syntaxhighlighting
m (Syntaxhighlighting)
Line 11: Line 11:
===Axis===
===Axis===
An axis part is required in every animation that involves a rotating or moving thing.
An axis part is required in every animation that involves a rotating or moving thing.
<source>
   <axis>
   <axis>
   <x>0</x>
   <x>0</x>
Line 16: Line 18:
   <z>0</z>
   <z>0</z>
   </axis>
   </axis>
</source>


The axis are similar to the ones of the 3D model. There is a difference between rotation and translation:
The axis are similar to the ones of the 3D model. There is a difference between rotation and translation:
Line 23: Line 26:
You could also define two points, between which FlightGear will calculate the correct axis. This makes the use of a [[#Center|<nowiki><center></nowiki>]] tag redundant! Such coordinates are extremely useful for animating control surfaces (rudder, elevators etc.).
You could also define two points, between which FlightGear will calculate the correct axis. This makes the use of a [[#Center|<nowiki><center></nowiki>]] tag redundant! Such coordinates are extremely useful for animating control surfaces (rudder, elevators etc.).


<source>
   <axis>   
   <axis>   
   <x1-m> 4.9</x1-m>
   <x1-m> 4.9</x1-m>
Line 31: Line 35:
   <z2-m>-0.5</z2-m>
   <z2-m>-0.5</z2-m>
   </axis>
   </axis>
</source>


===Center===
===Center===
Various animations ([[#Rotate|rotate]], [[#Spin|spin]]) move around a center point.
Various animations ([[#Rotate|rotate]], [[#Spin|spin]]) move around a center point.


  <nowiki><center></nowiki>
<source>
  <center>
   <x-m>-1.50</x-m>
   <x-m>-1.50</x-m>
   <y-m> 1  </y-m>
   <y-m> 1  </y-m>
   <z-m> 0.25</z-m>
   <z-m> 0.25</z-m>
   <nowiki></center></nowiki>
   </center>
</source>


The axis are similar to the ones of the 3D model, so finding coordinates is easily done in 3D modeling software.
The axis are similar to the ones of the 3D model, so finding coordinates is easily done in 3D modeling software.
Line 53: Line 60:


The example below is true when n1 has a value greater than 25.
The example below is true when n1 has a value greater than 25.
<source>
   <condition>
   <condition>
   <greater-than>
   <greater-than>
Line 59: Line 67:
   </greater-than>
   </greater-than>
   </condition>
   </condition>
</source>


Then there are some special tags:
Then there are some special tags:
Line 67: Line 76:


In the example below, the condition is true when either n1 is greater than 25% or equal to 0%.
In the example below, the condition is true when either n1 is greater than 25% or equal to 0%.
<source>
   <condition>
   <condition>
   <or>
   <or>
Line 79: Line 89:
   <or>
   <or>
   </condition>
   </condition>
</source>


An example of implementation into an animation looks as follows:
An example of implementation into an animation looks as follows:


<source>
  <animation>
  <animation>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
Line 93: Line 105:
   </greater-than>
   </greater-than>
   </condition>
   </condition>
   <nowiki><center></nowiki>
   <center>
   <x-m>-1.50</x-m>
   <x-m>-1.50</x-m>
   <y-m> 1  </y-m>
   <y-m> 1  </y-m>
   <z-m> 0.25</z-m>
   <z-m> 0.25</z-m>
   <nowiki></center></nowiki>
   </center>
   <axis>
   <axis>
   <x>0</x>
   <x>0</x>
Line 104: Line 116:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


===Interpolation===
===Interpolation===
For non-fixed factors, an interpolation "table" can be created.  
For non-fixed factors, an interpolation "table" can be created.  


<source>
   <interpolation>
   <interpolation>
   <entry>
   <entry>
Line 122: Line 136:
   </entry>
   </entry>
   </interpolation>
   </interpolation>
</source>


The lines above represent the following table:
The lines above represent the following table:
Line 144: Line 159:
With a name animation, you can group multiple objects.  
With a name animation, you can group multiple objects.  


<source>
  <animation>
  <animation>
   <name>Collection1</name>
   <name>Collection1</name>
Line 150: Line 166:
   <object-name>Object3</object-name>
   <object-name>Object3</object-name>
  </animation>
  </animation>
</source>


The example above creates a "virtual object" with the name Collection1. In animation, we can animate this group of objects, by using:
The example above creates a "virtual object" with the name Collection1. In animation, we can animate this group of objects, by using:


<source>
  <object-name>Collection1</object-name>
  <object-name>Collection1</object-name>
</source>


===Object-name===
===Object-name===
Line 160: Line 179:
==Animation types==
==Animation types==
===Alpha-test===
===Alpha-test===
<source>
  <animation>
  <animation>
   <type>alpha-test</type>
   <type>alpha-test</type>
Line 165: Line 185:
   <alpha-factor>0.01</alpha-factor>
   <alpha-factor>0.01</alpha-factor>
  </animation>
  </animation>
</source>


===Billboard===
===Billboard===
This faces an object towards the viewer. Often used on 2D objects, like clouds, trees and lights.
This faces an object towards the viewer. Often used on 2D objects, like clouds, trees and lights.


<source>
  <animation>
  <animation>
   <type>billboard</type>
   <type>billboard</type>
Line 174: Line 196:
   <spherical type="bool">true</spherical>
   <spherical type="bool">true</spherical>
  </animation>
  </animation>
</source>


* '''spherical:'''
* '''spherical:'''
Line 180: Line 203:
Used to scale an object, based on the distance to the viewer.
Used to scale an object, based on the distance to the viewer.


<source>
  <animation>
  <animation>
   <type>dist-scale</type>
   <type>dist-scale</type>
Line 198: Line 222:
   </interpolation>
   </interpolation>
  </animation>
  </animation>
</source>


===Enable-hot===
===Enable-hot===
Scenery objects are automatically defined as solid by FlightGear, meaning that an aircraft can taxi on them and/or crash when touching. For certain objects (groundmarkings, beacon light-beams etc.) this might be an unwanted feature. The solidness can be disabled with the following animation:
Scenery objects are automatically defined as solid by FlightGear, meaning that an aircraft can taxi on them and/or crash when touching. For certain objects (groundmarkings, beacon light-beams etc.) this might be an unwanted feature. The solidness can be disabled with the following animation:


<source>
  <animation>
  <animation>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
   <enable-hot type="bool">false</enable-hot>
   <enable-hot type="bool">false</enable-hot>
  </animation>
  </animation>
</source>


* '''enable-hot:''' can be either true or false. Remember that objects are automatically solid, so it should not be nesecarily to set this at all when wanting solidness.
* '''enable-hot:''' can be either true or false. Remember that objects are automatically solid, so it should not be nesecarily to set this at all when wanting solidness.


===Flash===
===Flash===
<source>
  <animation>
  <animation>
   <type>flash</type>
   <type>flash</type>
Line 219: Line 247:
   <min>0.0</min>
   <min>0.0</min>
   <max>1.0</max>
   <max>1.0</max>
   <nowiki><center></nowiki>
   <center>
   <x-m>0.0</x-m>
   <x-m>0.0</x-m>
   <y-m>0.0</y-m>
   <y-m>0.0</y-m>
   <z-m>0.0</z-m>
   <z-m>0.0</z-m>
   <nowiki></center></nowiki>
   </center>
   <axis>
   <axis>
   <x>0.0</x>
   <x>0.0</x>
Line 230: Line 258:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


*'''offset:'''
*'''offset:'''
Line 239: Line 268:


===Interactions===
===Interactions===
<source>
  <animation>  
  <animation>  
   <type>interaction</type>  
   <type>interaction</type>  
Line 244: Line 274:
   <interaction-type>carrier-wire</interaction-type>  
   <interaction-type>carrier-wire</interaction-type>  
  </animation>  
  </animation>  
</source>


*'''interaction-type:''' can have the following values:
*'''interaction-type:''' can have the following values:
Line 255: Line 286:
Used for the [[Livery over MP]] system.
Used for the [[Livery over MP]] system.


<source>
  <animation>  
  <animation>  
   <type>material</type>  
   <type>material</type>  
Line 262: Line 294:
   <texture>KLM.png</texture>  
   <texture>KLM.png</texture>  
  </animation>
  </animation>
</source>


====Illumination====
====Illumination====
{{Main article|Howto: Illuminate faces}}
{{Main article|Howto: Illuminate faces}}
<source>
  <animation>
  <animation>
   <type>material</type>
   <type>material</type>
Line 275: Line 309:
   </emission>
   </emission>
  </animation>
  </animation>
</source>


Emission colors are multiplied by the factor-prop value. 1 is maximum coclor intensity, while 0 is the minimum. Colors are calculated according to the [http://en.wikipedia.org/wiki/RGB_color_model RGB color model].
Emission colors are multiplied by the factor-prop value. 1 is maximum coclor intensity, while 0 is the minimum. Colors are calculated according to the [http://en.wikipedia.org/wiki/RGB_color_model RGB color model].


===Noshadow===
===Noshadow===
<source>
  <animation>
  <animation>
   <type>noshadow</type>
   <type>noshadow</type>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
  </animation>
  </animation>
</source>


===Pick===
===Pick===
Line 290: Line 327:
To prevent objects -like instruments- being drawn when the aircraft is actually too far away for them to be seen anyway, a range animation is used.  
To prevent objects -like instruments- being drawn when the aircraft is actually too far away for them to be seen anyway, a range animation is used.  


<source>
  <animation>
  <animation>
   <type>range</type>
   <type>range</type>
Line 295: Line 333:
   <max-m>30</max-m>
   <max-m>30</max-m>
  </animation>
  </animation>
</source>


* '''min-m:''' the shortest distance (in meters) from the object center at which it is visible.
* '''min-m:''' the shortest distance (in meters) from the object center at which it is visible.
Line 305: Line 344:


The animation code will look like this:
The animation code will look like this:
<source>
  <animation>
  <animation>
   <type>range</type>
   <type>range</type>
Line 310: Line 350:
   <max-property>sim/rendering/static-lod/bare</max-property>
   <max-property>sim/rendering/static-lod/bare</max-property>
  </animation>
  </animation>
</source>


You can have both ranges (max and min) bound to a property, or just one of them.
You can have both ranges (max and min) bound to a property, or just one of them.
Line 318: Line 359:
One of the most important and frequently used animations of all. It rotates an object to an absolute position in degrees, as provided by the property-value.
One of the most important and frequently used animations of all. It rotates an object to an absolute position in degrees, as provided by the property-value.


<source>
  <animation>
  <animation>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
Line 323: Line 365:
   <property>suface-positions/left-aileron-pos-norm</property>
   <property>suface-positions/left-aileron-pos-norm</property>
   <factor>25</factor>
   <factor>25</factor>
   <nowiki><center></nowiki>
   <center>
   <x-m>-1.50</x-m>
   <x-m>-1.50</x-m>
   <y-m> 1  </y-m>
   <y-m> 1  </y-m>
   <z-m> 0.25</z-m>
   <z-m> 0.25</z-m>
   <nowiki></center></nowiki>
   </center>
   <axis>
   <axis>
   <x>0</x>
   <x>0</x>
Line 334: Line 376:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


* '''factor:''' is optional.
* '''factor:''' is optional.
Line 340: Line 383:
A scale animation scales (resizes) an object. This can be either property-value dependant (first example) or a fixed scale (second example).
A scale animation scales (resizes) an object. This can be either property-value dependant (first example) or a fixed scale (second example).


<source>
  <animation>
  <animation>
   <type>scale</type>
   <type>scale</type>
Line 351: Line 395:
   <z-factor>2.0</z-factor>
   <z-factor>2.0</z-factor>
  </animation>
  </animation>
</source>


* ?-min: the mimimum scale factor for each axis. If the property value would result in a smaller factor than this setting, the scale animation will hold.
* ?-min: the mimimum scale factor for each axis. If the property value would result in a smaller factor than this setting, the scale animation will hold.
* ?-factor: the scale factor for each axis (factor*property=scale factor).
* ?-factor: the scale factor for each axis (factor*property=scale factor).


<source>
  <animation>
  <animation>
   <type>scale</type>
   <type>scale</type>
Line 361: Line 407:
   <z-offset>0.5</z-offset>
   <z-offset>0.5</z-offset>
  </animation>
  </animation>
</source>


* x.offset: the scale factor.
* x.offset: the scale factor.
Line 367: Line 414:
This animation selects (or unselects) objects when certain conditions are true (or false). The example below shows the object when the n1 of engine[1] is higher than 25%.
This animation selects (or unselects) objects when certain conditions are true (or false). The example below shows the object when the n1 of engine[1] is higher than 25%.


<source>
  <animation>
  <animation>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
Line 377: Line 425:
   </condition>
   </condition>
  </animation>
  </animation>
</source>


===Shader===
===Shader===
<source>
  <animation>
  <animation>
   <type>shader</type>
   <type>shader</type>
Line 385: Line 435:
   <object-name>Object</object-name>
   <object-name>Object</object-name>
  </animation>
  </animation>
</source>


* '''shader:'''  
* '''shader:'''  
Line 392: Line 443:
Very similar to [[#Rotate|rotate]], but the property provides a value in revolutions per minute (RPM) rather than an absolute position in degrees, and offset cannot be used.
Very similar to [[#Rotate|rotate]], but the property provides a value in revolutions per minute (RPM) rather than an absolute position in degrees, and offset cannot be used.


<source>
  <animation>
  <animation>
   <object-name>Object</object-name>
   <object-name>Object</object-name>
Line 397: Line 449:
   <property>engines/engine[0]/n1</property>
   <property>engines/engine[0]/n1</property>
   <factor>25</factor>
   <factor>25</factor>
   <nowiki><center></nowiki>
   <center>
   <x-m>-1.50</x-m>
   <x-m>-1.50</x-m>
   <y-m> 1  </y-m>
   <y-m> 1  </y-m>
   <z-m> 0.25</z-m>
   <z-m> 0.25</z-m>
   <nowiki></center></nowiki>
   </center>
   <axis>
   <axis>
   <x>0</x>
   <x>0</x>
Line 408: Line 460:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


* '''factor:''' is optional.
* '''factor:''' is optional.
Line 414: Line 467:
A very important animation for cockpits! This animation moves textures over a surface.
A very important animation for cockpits! This animation moves textures over a surface.


<source>
  <animation>
  <animation>
   <type>textranslate</type>
   <type>textranslate</type>
Line 426: Line 480:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


* '''factor:'''
* '''factor:'''
Line 434: Line 489:
Swtiches between objects at specified intervals. This example switches between a lights-on model and a lights-off model. Lights on are shown 0.2 seconds, while lights off are displayed for 0.8 seconds.
Swtiches between objects at specified intervals. This example switches between a lights-on model and a lights-off model. Lights on are shown 0.2 seconds, while lights off are displayed for 0.8 seconds.


<source>
  <animation>
  <animation>
   <type>timed</type>
   <type>timed</type>
Line 442: Line 498:
   <branch-duration-sec>0.2</branch-duration-sec>
   <branch-duration-sec>0.2</branch-duration-sec>
  </animation>
  </animation>
</source>


===Translate===
===Translate===
The same as [[#Textranslate|textranslate]], but this animation moves a whole object (so including fixed textures). The example below will move an object 5 meters in the y-direction.
The same as [[#Textranslate|textranslate]], but this animation moves a whole object (so including fixed textures). The example below will move an object 5 meters in the y-direction.


<source>
  <animation>
  <animation>
   <type>translate</type>
   <type>translate</type>
Line 457: Line 515:
   </axis>
   </axis>
  </animation>
  </animation>
</source>


[[Category:Aircraft enhancement|Animate models]]
[[Category:Aircraft enhancement|Animate models]]

Navigation menu