diff --git a/Docs/model-howto.html b/Docs/model-howto.html index 25f5e3afd..6adb679be 100644 --- a/Docs/model-howto.html +++ b/Docs/model-howto.html @@ -37,15 +37,15 @@ FlightGear's property system and XML markup, and will need to understand the coordinate system FlightGear uses for its models:
@@ -55,8 +55,8 @@ viewed from behind

This mini-HOWTO contains three parts:

    -
  1. Loading the model
  2. -
  3. Repositioning the model
  4. +
  5. Loading the model +
  6. Repositioning the model
  7. Animating the model
@@ -182,7 +182,12 @@ straight up.

property tree), there are six properties that allow you to tweak the default position and orientation of the model:

-
/offsets/x-m
The distance to reposition the model along the x-axis.
/offsets/y-m
The distance to reposition the model along the y-axis.
/offsets/z-m
The distance to reposition the model along the z-axis.
/offsets/heading-deg
The angle by which to rotate the model around the z-axis.
/offsets/roll-deg
The angle by which to rotate the model around the x-axis.
/offsets/pitch-deg
The angle by which to rotate the model around the y-axis.
+
/offsets/x-m
The distance to reposition the model along the + x-axis.
/offsets/y-m
The distance to reposition the model along the + y-axis.
/offsets/z-m
The distance to reposition the model along the + z-axis.
/offsets/heading-deg
The angle by which to rotate the model around + the z-axis.
/offsets/roll-deg
The angle by which to rotate the model around + the x-axis.
/offsets/pitch-deg
The angle by which to rotate the model around the y-axis.

For example, if you wanted to use the 3D model my-cessna.wrl but found that the nose was pointing to the @@ -224,27 +229,29 @@ information.

Currently, there are several types of animation recognized:

    -
  1. none
  2. -
  3. billboard
  4. -
  5. rotate
  6. -
  7. scale
  8. -
  9. blend
  10. -
  11. select
  12. -
  13. spin
  14. -
  15. timed
  16. -
  17. translate
  18. -
  19. texrotate
  20. -
  21. textranslate
  22. -
  23. textmultiple
  24. -
  25. material
  26. -
  27. range
  28. -
  29. alpha-test
  30. -
  31. noshadow
  32. +
  33. none +
  34. billboard +
  35. rotate +
  36. scale +
  37. blend +
  38. select +
  39. spin +
  40. timed +
  41. translate +
  42. texrotate +
  43. textranslate +
  44. textmultiple +
  45. material +
  46. range +
  47. alpha-test +
  48. noshadow +
  49. dist-scale +
  50. flash

Typically you will use combinations of rotate, spin, and translate to animate the main control surfaces for most standard-configuration -aircraft. none is a no-op; spin rotates the +aircraft. spin rotates the object around an axis with a known rotational velocity (not worrying about the exact position), and rotate rotates the object around an axis to an exact position.

@@ -259,6 +266,15 @@ contains a type property and at least one </animation> +

It is possible to omit the type parameter. In this case, +the type is none and the animation is there only to group +objets under a single name that can be used in another animation located +farther in the file. Grouping objects in animations, with a type +or not, has the effect of reparenting the objects specified in object-name. +The rule is that the group is inserted between the first object and its parent, +and then subsequent objects are removed from their original parent and added +to the new group.

+

The object name must match exactly the object name used in the 3D file (including case). You may include more than one object name to apply the same transformation to more than one object, assuming that @@ -271,6 +287,22 @@ they rotate around exactly the same line:

</animation> +

It is possible to omit the type parameter. In this case, +the type is null and the animation is there only to group +objets under a single name that can be used in another animation located +farther in the file. Grouping objects in animations, with a type +or not, has the effect of reparenting the objects specified in object-name. +The rule is that the group is inserted between the first object and its parent, +and then subsequent objects are removed from their original parent and added +to the new group.

+ +

The resulting branch is solid when it comes to compute Height Over Terrain (HOT). +When an object is there to model a beam of light, or another non solid artefact, it +can be interesting to ignore it for crash detection. It is done by inserting

+
<enable-hot type="boolean">false</enable-hot>
+

in the animation clause. By default, enable-hot is set to true and one +can land on the roof of a building.

+

Each animation must be associated with exactly one property from the main FlightGear property tree (remember that the properties in the wrapper file are not part of the main tree), using property @@ -627,6 +659,18 @@ the same object (such as a translucent propeller disk for high RPM), non-rotational transformations, scaling, and conditionals (i.e. draw engine exhaust only above a certain velocity).

+

It is often desired to apply several animations on the same object. +It is simply done by specifying multiple animations with the same +object-name. But you must be aware of the order of execution of +these specified animations. Every new animation takes precedence over previously +declared one. As we already seen, each new animation is inserted as the parent +of the object specified as the first object-name. That means that if +a rotation is already declared, and a new translation is to be inserted, it will +be between the rotation and the object, making the translation acting on the +object, and the rotation acting on the translated object.
+So, as a rule of thumb, remember that animations are executed from the +bottom of the animation file to its top.

+

"scale" animation type

Here is a contrived example of one way to use the "scale" animation @@ -719,7 +763,9 @@ an object. To controll it's behavior it is possible to define:

the result by defining a <min> and/or a <max> parameter.

-

Note: This effect will only work if there is already a transparent component in the object, either in the vertex color or in the texture. +

Note: This + effect will only work if there is already a transparent component in the + object, either in the vertex color or in the texture. @@ -793,7 +839,8 @@ on the primary flight display:

There are also some special properties available for use in the texture animations. These are:

    -
  1. step
  2. +
  3. step +
  4. scroll
@@ -807,7 +854,7 @@ property value should be from a step when scrolling to the next position begins. This type of scrolling is common on EFIS cockpit displays. The following example gives an "odometer effect" where the hundreds position digit doesn't move until the input value -is within is within 1 (e.g. > 99):

+is within is within 1 (e.g. > 99):

<animation>
   <type>textranslate</type>
@@ -917,7 +964,86 @@ display explains the format clearly:

-

"material" animation type

+

"dist-scale" animation type

+

This animation enables to scale an object based on the distance of its + center to the viewer. It was designed to compensate the effect of fog on + emissive (light) sources that is too strong ( lights are hardly visible at distance )
+ Parameters, with default values, are :

+
+
<animation>
+ <type>dist-scale</type>
+ <object-name>RedLight.11</object-name>
+ <factor>1.0</factor>
+ <offset>0.0</offset>
+ <min>0.0</min>
+ <max>1.0</max>
+ <center>
+  <x-m>0.0</x-m>
+  <y-m>0.0</y-m>
+  <z-m>0.0</z-m>
+ </center>
+</animation>
+   
+
+

Or, with an interpolation table :

+
+
<animation>
+ <type>dist-scale</type>
+ <object-name>RedLight.11</object-name>
+ <interpolation>
+  <entry><ind>0</ind><dep>0.1</dep></entry>
+  <entry><ind>500</ind><dep>0.2</dep></entry>
+  <entry><ind>16000</ind><dep>3</dep></entry>
+ </interpolation>
+ <min>0.0</min>
+ <max>3.0</max>
+ <center>
+  <x-m>0.0</x-m>
+  <y-m>0.0</y-m>
+  <z-m>0.0</z-m>
+ </center>
+</animation>
+   
+
+ +

"flash" animation type

+

This animation was designed to scale an object based on the angle between + an arbitrary axis and the axis that goes between the viewer and the center of + the object. The sought effect was the flash of a lighthouse or beacon, + or whatever intense narrow light beam, hence the name.
+ Parameters, with default values, are :

+
+
<animation>
+ <type>flash</type>
+ <object-name>WhiteFlash.2</object-name>
+ <offset>0.0</offset>
+ <factor>1.0</factor>
+ <power>1.0</power>
+ <two-sides type="boolean">false</two-sides>
+ <min>0.0</min>
+ <max>1.0</max>
+ <center>
+  <x-m>0.0</x-m>
+  <y-m>0.0</y-m>
+  <z-m>0.0</z-m>
+ </center>
+ <axis>
+  <x>0.0</x>
+  <y>0.0</y>
+  <z>1.0</z>
+ </axis>
+</animation>
+   
+
+

The scale formulae is :
+

S = factor * pow( cos_angle, power ) + offset

+ cos_angle being the cosine of the angle between the axis and the line + between the center and the viewer.
+ The value S is clamped between min and max.
+ No interpolation table is allowed in this animation. +

+ +

"material" animation type

This "animation" can set any of the material properties on a model branch, including the texture file path. The following minimalistic example animation allows to change the "panel" object's emissive color from (0,0,0) to (1,.2,0) by setting the factor property @@ -1058,13 +1184,13 @@ the same that you would set in <property-base>.


David Megginson, 11 March 2002
- +
+ + - -