Howto:Animate gear scissors: Difference between revisions

Jump to navigation Jump to search
Usage of the <syntaxhighlight> tag.
mNo edit summary
(Usage of the <syntaxhighlight> tag.)
Line 52: Line 52:


This should produce a lot of output. This is the interpolation table that checks the compression of the gear strut and derives the angular deflection of the scissor arm. It should look like this:
This should produce a lot of output. This is the interpolation table that checks the compression of the gear strut and derives the angular deflection of the scissor arm. It should look like this:
<syntaxhighlight lang=xml>
  <?xml version = '1.0' encoding = 'UTF-8' ?>
  <?xml version = '1.0' encoding = 'UTF-8' ?>
  <PropertyList>
  <PropertyList>
Line 67: Line 68:
  ...
  ...
  </PropertyList>
  </PropertyList>
</syntaxhighlight>
Your numbers will look different but the structure should be the same. Save this output into a file named '''GearScissorInterpolation.xml''' and save this file in the same folder where your 3D model lives.
Your numbers will look different but the structure should be the same. Save this output into a file named '''GearScissorInterpolation.xml''' and save this file in the same folder where your 3D model lives.
Note: in a console environment, you can usually save a program's output by forwarding it to a file using the > operator:
Note: in a console environment, you can usually save a program's output by forwarding it to a file using the > operator:
Line 75: Line 77:
Before you continue, locate the rotation points of the two scissor arms where they are connected to the main strut. These are the vertices that were marked to measure the scissor distance.
Before you continue, locate the rotation points of the two scissor arms where they are connected to the main strut. These are the vertices that were marked to measure the scissor distance.
Open the XML file that contains the animations for you model and add the following lines within the <PropertyList></PropertyList> elements:
Open the XML file that contains the animations for you model and add the following lines within the <PropertyList></PropertyList> elements:
  &lt;animation>
<syntaxhighlight lang=xml>
     &lt;type>rotate</type>
  <animation>
     &lt;object-name>A</object-name>
     <type>rotate</type>
     &lt;property>gear/gear[1]/compression-norm</property>
     <object-name>A</object-name>
     &lt;axis>
     <property>gear/gear[1]/compression-norm</property>
       &lt;x>-1</x>
     <axis>
     &lt;/axis>
       <x>-1</x>
     &lt;center>
     </axis>
       &lt;x-m>YOUR X LOCATION OF THE ROTATION POINT HERE</x-m>
     <center>
       &lt;y-m>YOUR Y LOCATION OF THE ROTATION POINT HERE</y-m>
       <x-m>YOUR X LOCATION OF THE ROTATION POINT HERE</x-m>
       &lt;z-m>YOUR Z LOCATION OF THE ROTATION POINT HERE</z-m>
       <y-m>YOUR Y LOCATION OF THE ROTATION POINT HERE</y-m>
     &lt;/center>
       <z-m>YOUR Z LOCATION OF THE ROTATION POINT HERE</z-m>
     &lt;interpolation include="GearScissorInterpolation.xml"/>
     </center>
     <interpolation include="GearScissorInterpolation.xml"/>
  </animation>
  </animation>
</syntaxhighlight>
Fill in your values for x-m, y-m and z-m for the location of the rotation vertices. Add another section for the second scissor arm, replace the object-name with '''B''' and set the axis to +1 instead of -1.
Fill in your values for x-m, y-m and z-m for the location of the rotation vertices. Add another section for the second scissor arm, replace the object-name with '''B''' and set the axis to +1 instead of -1.
If you see the scissors move in the opposite direction, exchange the sign in the axis definition.
If you see the scissors move in the opposite direction, exchange the sign in the axis definition.

Navigation menu