Howto:Creating 3D instruments: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 27: Line 27:


[[Image:Fokker51_ITT_screenshot1.jpg]]
[[Image:Fokker51_ITT_screenshot1.jpg]]
'''Adding an animation:'''


As you can see, the main item to animate is the temperature needle, and its name is "needle" (you can animate either ac3d "objects" or complete "groups").  We will want to use a "rotate" animation (for more details on available animation types, see "model-howto.html" which is provided with FG in the Docs directory.)
As you can see, the main item to animate is the temperature needle, and its name is "needle" (you can animate either ac3d "objects" or complete "groups").  We will want to use a "rotate" animation (for more details on available animation types, see "model-howto.html" which is provided with FG in the Docs directory.)
Line 32: Line 35:
So, we add an <animation> section to our XML file.
So, we add an <animation> section to our XML file.


<pre>
  <animation>
  <animation>
   <type>rotate</type>
   <type>rotate</type>
   <object-name>needle</object-name>
   <object-name>needle</object-name>
</pre>


Now, we need to specify a property which will determine the amount of rotation required; in other words, the property that provides the ITT value at any one time.  To find the name of this property, we need to start FlightGear in the usual manner with the correct aircraft (fokker50 in this case).  Once FG has started, open the property browser (file/browse internal properties).  You will see the top level of the property tree.  Click on "engines" and you will see a list of engines; click on the first one (engine) and you will see a long list of properties and their current values.
Now, we need to specify a property which will determine the amount of rotation required; in other words, the property that provides the ITT value at any one time.  To find the name of this property, we need to start FlightGear in the usual manner with the correct aircraft (fokker50 in this case).  Once FG has started, open the property browser (file/browse internal properties).  You will see the top level of the property tree.  Click on "engines" and you will see a list of engines; click on the first one (engine) and you will see a long list of properties and their current values.
Line 51: Line 56:
On to our table then.
On to our table then.


<pre>
  <interpolation>
  <interpolation>
   <entry><ind>32</ind><dep>0</dep></entry>
   <entry><ind>32</ind><dep>0</dep></entry>
   <entry><ind>2192</ind><dep>230</dep></entry>
   <entry><ind>2192</ind><dep>230</dep></entry>
  </interpolation>
  </interpolation>
</pre>


The <ind> entries are what's indicated on the gauge; the <dep> entries determine how many degrees the object will be rotated by.  I found that number by rotating the needle in AC3D from one end of the scale to the other and reading off the rotation value reported (see screenshot)
The <ind> entries are what's indicated on the gauge; the <dep> entries determine how many degrees the object will be rotated by.  In this case I found that number by rotating the needle in AC3D from one end of the scale to the other and reading off the rotation value reported (see screenshot)


[[Image:Fokker50_rotation_value.jpg]]
[[Image:Fokker50_rotation_value.jpg]]
Having configured the type of animation, the controlling property, and specified the effect of that property, we need to describe an axis and centre for the animation.
In this case, the centre is easy, because the needle centre is at the origin of the 3d model.  If you wanted the rotation centre to be somewhere else, you could use your modelling app to obtain these values.
<pre>
<center>
  <x-m>0</x-m>
  <y-m>0</y-m>
  <z-m>0</z-m>
</center>
</pre>
The axis is also very simple in this case;
<pre>
<axis>
  <x>-1</x>
  <y>0</y>
  <z>0</z>
</axis>
</pre>
The negative sign on the x axis means that the rotation will be clockwise when viewed from the -x direction (i.e. looking "forwards")
That concludes the rotation animation and so (as always) we need to add a suitable closing tag;
</animation>
57

edits

Navigation menu