Howto:Animate models: Difference between revisions

Jump to navigation Jump to search
m
Robot: Cosmetic changes
m (Syntaxhighlighting)
m (Robot: Cosmetic changes)
Line 3: Line 3:
This document provides basic information for all kind of animations. For more complex animations, you are advised to check the available [[aircraft]] for examples.
This document provides basic information for all kind of animations. For more complex animations, you are advised to check the available [[aircraft]] for examples.


==A note about animation order==
== A note about animation order ==
{{stub}}
{{stub}}


Animations are executed by FlightGear in the order that they are read in the model's .xml file. Therefore, it is very important to pay attention to the order, especially when multiple animations are applied to the same object(s).
Animations are executed by FlightGear in the order that they are read in the model's .xml file. Therefore, it is very important to pay attention to the order, especially when multiple animations are applied to the same object(s).


==Special code parts==
== Special code parts ==
===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.


Line 37: Line 37:
</source>
</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.


Line 50: Line 50:
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.


===Conditions===
=== Conditions ===
Multiple animations can make use of a conditional.
Multiple animations can make use of a conditional.


Line 118: Line 118:
</source>
</source>


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


Line 156: Line 156:
You can add as many entries as you need. Interpolation tables are often used for gear animations (eg. to open doors during gear-movements and close them again once the gear is either retracted or fully extended).
You can add as many entries as you need. Interpolation tables are often used for gear animations (eg. to open doors during gear-movements and close them again once the gear is either retracted or fully extended).


===Name===
=== Name ===
With a name animation, you can group multiple objects.  
With a name animation, you can group multiple objects.  


Line 174: Line 174:
</source>
</source>


===Object-name===
=== Object-name ===
These names are set in the 3D model. Each single object has a unique name; for easy identification it is advised to use descriptive names (LeftElevator, Rudder etc.). Animations are only applied to those objects that are mentioned in an object-name line (one object per line!). Animations lacking those, will be applied to the entire model.
These names are set in the 3D model. Each single object has a unique name; for easy identification it is advised to use descriptive names (LeftElevator, Rudder etc.). Animations are only applied to those objects that are mentioned in an object-name line (one object per line!). Animations lacking those, will be applied to the entire model.


==Animation types==
== Animation types ==
===Alpha-test===
=== Alpha-test ===
<source>
<source>
  <animation>
  <animation>
Line 187: Line 187:
</source>
</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.


Line 200: Line 200:
* '''spherical:'''
* '''spherical:'''


===Dist-scale===
=== Dist-scale ===
Used to scale an object, based on the distance to the viewer.
Used to scale an object, based on the distance to the viewer.


Line 224: Line 224:
</source>
</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:


Line 236: Line 236:
* '''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>
<source>
  <animation>
  <animation>
Line 260: Line 260:
</source>
</source>


*'''offset:'''
* '''offset:'''
*'''factor:'''
* '''factor:'''
*'''power:'''
* '''power:'''
*'''two-sides:'''
* '''two-sides:'''
*'''min:'''
* '''min:'''
*'''max:'''
* '''max:'''


===Interactions===
=== Interactions ===
<source>
<source>
  <animation>  
  <animation>  
Line 276: Line 276:
</source>
</source>


*'''interaction-type:''' can have the following values:
* '''interaction-type:''' can have the following values:
**'''carrier-catapult:'''
** '''carrier-catapult:'''
**'''carrier-wire:''' makes the object act as an arresting wire, as used on [[aircraft carrier]]s.
** '''carrier-wire:''' makes the object act as an arresting wire, as used on [[aircraft carrier]]s.


===Material===
=== Material ===
An animation type that can be used in various ways.
An animation type that can be used in various ways.


====Changing liveries====
==== Changing liveries ====
Used for the [[Livery over MP]] system.
Used for the [[Livery over MP]] system.


Line 296: Line 296:
</source>
</source>


====Illumination====
==== Illumination ====
{{Main article|Howto: Illuminate faces}}
{{Main article|Howto: Illuminate faces}}
<source>
<source>
Line 313: Line 313:
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>
<source>
  <animation>
  <animation>
Line 321: Line 321:
</source>
</source>


===Pick===
=== Pick ===
{{Main article|Howto: Make a clickable panel#Pick}}
{{Main article|Howto: Make a clickable panel#Pick}}


===Range===
=== Range ===
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.  


Line 356: Line 356:
* '''max-property:'''
* '''max-property:'''


===Rotate===
=== Rotate ===
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.


Line 380: Line 380:
* '''factor:''' is optional.
* '''factor:''' is optional.


===Scale===
=== Scale ===
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).


Line 411: Line 411:
* x.offset: the scale factor.
* x.offset: the scale factor.


===Select===
=== Select ===
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%.


Line 427: Line 427:
</source>
</source>


===Shader===
=== Shader ===
<source>
<source>
  <animation>
  <animation>
Line 440: Line 440:
* '''texture:''' path to the texture used by the shader.
* '''texture:''' path to the texture used by the shader.


===Spin===
=== Spin ===
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.


Line 464: Line 464:
* '''factor:''' is optional.
* '''factor:''' is optional.


===Textranslate===
=== Textranslate ===
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.


Line 486: Line 486:
property * factor * step * texture width/height = the amount of pixels that the texture should be translated. If your texture is 256 pixels, an textranslate of 0.1 will result in the texture moving with 26 pixels, into the direction specified by the axis settings.
property * factor * step * texture width/height = the amount of pixels that the texture should be translated. If your texture is 256 pixels, an textranslate of 0.1 will result in the texture moving with 26 pixels, into the direction specified by the axis settings.


===Timed===
=== Timed ===
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.


Line 500: Line 500:
</source>
</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.


Navigation menu