Howto:Animate models: Difference between revisions

Jump to navigation Jump to search
Some small corrections, added documentation about commit 51149bf: Support expressions in material animations
(Add note about added axis-object support for slider and locked-track animations on Git next.)
(Some small corrections, added documentation about commit 51149bf: Support expressions in material animations)
Line 582: Line 582:


=== 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 in the y-direction:
This animation moves an object along an axis (not to be confused with the <code>textranslate</code> animation which only moves the texture on the UV map, not the geometry). The example below will move an object in the Y direction:


{| class="wikitable" border="0" cellspacing="0"  
{| class="wikitable" border="0" cellspacing="0"  
Line 621: Line 621:
</interpolation>
</interpolation>
</source>
</source>
The first figure (<ind> refers to the value of the property associated with the object and the second figure (in <dep>) refers to the amount that the object moves in metres. For example, in this case, the object moves 18cm when the value reads 0.66 and 27cm when the value is 1.
The first figure (<code><ind></code>) refers to the value of the property associated with the object and the second figure (<code><dep></code>) refers to the amount that the object moves in metres. For example, in this case, the object moves 18cm when the value reads 0.66 and 27cm when the value is 1.


'''IF used WTIHOUT property''' : The object is placed at some (Value of Offset) meters away from its original position, along the virtual axis formed by said original position and the point with coordinates x/y/z defined in the <axis> tag.
'''IF used WTIHOUT property''' : The object is placed at some (Value of Offset) meters away from its original position, along the virtual axis formed by said original position and the point with coordinates x/y/z defined in the <axis> tag.
Line 632: Line 632:


== Material animation ==
== Material animation ==
An animation type that can be used in various ways. Of course you can combine the below mentiond systems into one (big) animation.
Animate the material properties of an object, such as it's texture, shininess or color.


<source>
<source lang="xml">
  <animation>  
  <animation>  
   <type>material</type>  
   <type>material</type>  
   <object-name>Object</object-name>
   <object-name>Object</object-name>
   <property-base>sim/model/c172p/material</property-base>
   <property-base>sim/model/c172p/material</property-base>
  <global type="bool">true</global> <!-- This tag is no longer supported -->
   ...
   ...
   lines as mentioned below
   lines as mentioned below
Line 647: Line 646:


'''Optional:'''
'''Optional:'''
* '''property-base:''' when using prop(erties), you might want to set a property-base. All props will be relative to this path.
* '''property-base:''' All other properties of this animation will be relative to this property node.
* '''global (deprecated):''' by setting this to <tt>true</tt>, all objects using the same material as the defined object(s) (via <tt><object-name></tt>) will be affected by the animation. This is preferred to listing several objects in <object-name> tags. It's not only faster, but also doesn't break animations by forcing objects together. <span style="color:red; text-decoration: underline;">This tag is no longer supported</span>


'''Notes:'''
'''Notes:'''
* Numbers are clamped to 0.0-1.0, except "shininess", which is clamped to 0-128.
* Numbers are clamped to 0.0 - 1.0, except <code>shininess</code>, which is clamped to 0 - 128.
* By appending <tt>-prop</tt> each of the material properties can read its value from another property.
* By appending <tt>-prop</tt> each of the material properties can read its value from another property.
* '''New since SimGear commit <code>51149bf</code>''': For each of the color components (<code>ambient</code>, <code>diffuse</code>, <code>emission</code> and <code>specular</code>), the <code>red</code>, <code>green</code>, <code>blue</code>, <code>factor</code> and <code>offset</code> tags can each contain an [[Expressions|expression]] instead of a value.


=== Ambient ===
=== Ambient ===
Line 684: Line 683:


Emission colors are multiplied by the factor-prop value. 1 is maximum color 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 color intensity, while 0 is the minimum. Colors are calculated according to the [http://en.wikipedia.org/wiki/RGB_color_model RGB color model].
=== Shininess ===
Shininess is clamped to 0-128.
<source>
  <shininess>105</shininess>
</source>


=== Specular ===
=== Specular ===
Line 698: Line 691:
   <blue>0.0</blue>
   <blue>0.0</blue>
   </specular>
   </specular>
</source>
=== Texture ===
Used for the [[Livery over MP]] system.
<source>
  <property-base>sim/model/livery</property-base>
  <texture-prop>engine</texture-prop>
  <texture>KLM.png</texture>
</source>
</source>


Line 716: Line 700:
   <offset>1</offset>
   <offset>1</offset>
   </transparency>
   </transparency>
</source>
=== Shininess ===
Shininess is clamped to 0-128.
<source>
  <shininess>105</shininess>
</source>
</source>


Line 721: Line 711:
<source>
<source>
   <threshold>0.001</threshold>
   <threshold>0.001</threshold>
</source>
=== Texture ===
Used for the [[Livery over MP]] system.
<source>
  <property-base>sim/model/livery</property-base>
  <texture-prop>engine</texture-prop>
  <texture>KLM.png</texture>
</source>
</source>


== Texture Animations ==
== Texture Animations ==
Applying different matrix transformations to the textures of an object.
Applying different matrix transformations to the textures of an object.


97

edits

Navigation menu