Howto:Animate gear scissors using the tracking animation: Difference between revisions

Jump to navigation Jump to search
+-Headings; +-Minor cleanup; +cat: Modeling
m (Johan G moved page Tracking animation to Howto:Animating gear scissors using the tracking animation: More descriptive title)
(+-Headings; +-Minor cleanup; +cat: Modeling)
Line 1: Line 1:
The new (in 2.11) '''locked-track animation''' can do exactly the same thing as the [http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Tracking/Locked_Track Locked Track constraint] available in Blender. However it can also be used to simulate simple inverse kinematic systems consisting of two bones connected with a revolute joint (aka hinge).
The new (in 2.11) '''locked-track animation''' can do exactly the same thing as the [http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Tracking/Locked_Track Locked Track constraint] available in Blender. However it can also be used to simulate simple inverse kinematic systems consisting of two bones connected with a revolute joint (also known as a hinge).


==Blender==
If you get used to Blender its a really powerful tool (I have problems if trying to work with other modelling programs :P) and with using the
If you get used to Blender its a really powerful tool (I have problems if trying to work with other modelling programs :P) and with using the
right scripts it gets a very neat tool for creating models for FlightGear. For example for a gear scissor just add an armature with two bones, add an IK constraint to the second bone and attach an element of the scissor to each bone, and you are done. You can watch the animation in Blender and using an exporter script now it is possible to watch exactly the same animation inside FlightGear. You don't need to guess any coordinates/axes/etc. and if you modify and object you just have to export it again, without manually modifying the animation xml.
right scripts it gets a very neat tool for creating models for FlightGear. For example for a gear scissor just add an armature with two bones, add an inverse kinematic (IK) constraint to the second bone and attach an element of the scissor to each bone, and you are done. You can watch the animation in Blender and using an exporter script now it is possible to watch exactly the same animation inside FlightGear. You do not need to guess any coordinates/axes/etc. and if you modify and object you just have to export it again, without manually modifying the animation XML file.


There are (currently) only two axes required. The lock-axis and the track-axis. They should be orthogonal, as the rotation is only possible round the lock-axis. Internally the track-axis is always orthonormalized to the lock-axis, as calculations always are performed in the plane normal to the lock-axis.
There are (currently) only two axes required. The <code>lock-axis</code> and the <code>track-axis</code>. They should be orthogonal, as the rotation is only possible round the <code>lock-axis</code>. Internally the <code>track-axis</code> is always orthonormalized to the <code>lock-axis</code>, as calculations always are performed in the plane normal to the <code>lock-axis</code>.


<gallery widths=200 heights=200>
<gallery widths=200 heights=200>
File:Tracking animation (locked-track initial pose).png|Initial pose
File:Tracking animation (locked-track initial pose).png|Initial pose
File:Tracking animation (locked-track target moved).png|The target has moved and the '''locked-track''' animation ensures the object still points at the target (with the '''track-axis''')
File:Tracking animation (locked-track target moved).png|The target has moved and the <code>locked-track</code> animation ensures the object still points at the target (with the <code>track-axis</code>)
File:Tracking animation (locked-track target moved outside plane).png|The target is projected into the plane defined by the object center and the '''lock-axis''' before the '''locked-track''' animation is applied.
File:Tracking animation (locked-track target moved outside plane).png|The target is projected into the plane defined by the object center and the <code>lock-axis</code> before the <code>locked-track</code> animation is applied.
</gallery>
</gallery>
{{#ev:youtube|bWGLapFgOtw}}
{{#ev:youtube|bWGLapFgOtw}}


For example, you can use the normal rotate animation to rotate the main strut. Every attached hydraulic cylinder, link, etc. is then animated using the
For example, you can use the normal rotate animation to rotate the main strut. Every attached hydraulic cylinder, link, etc. is then animated using the
locked-track animation. For a hydraulic cylinder the piston and the cylinder housing each are animated using a locked-track animation tracking each other. For a gear scissor, a locked-track animation tracks from a point attached to the strut to a point on the axis. Two objects can be attached to the animation, allowing to animate a scissor. (The object and the slave object, are rotated such that the exactly fill the space between the two attachment points of the scissor).
<code>locked-track</code> animation. For a hydraulic cylinder the piston and the cylinder housing each are animated using a <code>locked-track</code> animation tracking each other. For a gear scissor, a <code>locked-track</code> animation tracks from a point attached to the strut to a point on the axis. Two objects can be attached to the animation, allowing to animate a scissor. (The object and the slave object, are rotated such that the exactly fill the space between the two attachment points of the scissor).


For the animation a center point and an orientation (axis) are required to calculate the location and orientation of the rotation. Think of the center as the location of the hinge somewhere in space and of the axis as the actual orientation of the hinge. You can now either specify the position of the hinge and the orientation of its axis or (the alternate form) two points on the axis of the hinge, which are then used to calculate the center and orientation of the hinge. (If you use the alternate form the center and axis are automatically calculated from the two given points).
For the animation a center point and an orientation (axis) are required to calculate the location and orientation of the rotation. Think of the center as the location of the hinge somewhere in space and of the axis as the actual orientation of the hinge. You can now either specify the position of the hinge and the orientation of its axis or (the alternate form) two points on the axis of the hinge, which are then used to calculate the center and orientation of the hinge. (If you use the alternate form the center and axis are automatically calculated from the two given points).
Line 20: Line 21:
There is no rotation that you can not describe with a single axis
There is no rotation that you can not describe with a single axis
given by its xyz coordinates.
given by its xyz coordinates.


=== Slave center/object ===
=== Slave center/object ===
 
The <code>slave-center</code> specifies the location of the revolute joint. Optionally an object can be specified using <code>slave-name</code>, which will be attached to the animated object and also tracks to the target object.
The '''slave-center''' specifies the location of the revolute joint. Optionally an object can be specified using '''slave-name''', which will be attached to the animated object and also tracks to the target object.


<gallery widths=320 heights=256>
<gallery widths=320 heights=256>
File:Tracking animation with slave object.png|Initial pose
File:Tracking animation with slave object.png|Initial pose
File:Tracking animation with slave object (scissor, inverse kinematics).png|The target has moved and the '''locked-track''' animation ensures the '''track-axis''' still points at the target. The '''object''' and the '''slave-object''' are rotated such that the available space is exactly filled (aka scissor animation).  
File:Tracking animation with slave object (scissor, inverse kinematics).png|The target has moved and the <code>locked-track</code> animation ensures the <code>track-axis</code> still points at the target. The <code>object</code> and the <code>slave-object</code> are rotated such that the available space is exactly filled (aka scissor animation).  
</gallery>
</gallery>


Line 67: Line 66:
</syntaxhighlight>
</syntaxhighlight>


Gear scissor/Link with joint (In Blender the same animation can be achieved using an armature with two bones and an IK constraint applied to the second bone, tracking the target object. The animated object is attached to the first bone and the slave object to the second bone.):
Gear scissor/link with joint (In Blender the same animation can be achieved using an armature with two bones and an IK constraint applied to the second bone, tracking the target object. The animated object is attached to the first bone and the slave object to the second bone.):


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 109: Line 108:
</syntaxhighlight>
</syntaxhighlight>


Use a condition to disable tracking (and optionally apply specify a rotation beeing applied while disabled):
Use a condition to disable tracking (and optionally apply specify a rotation being applied while disabled):


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 155: Line 154:
</syntaxhighlight>
</syntaxhighlight>


== Lessons Learned ==
== Lessons learned ==
=== Scissors - with parenting ===
=== Scissors - with parenting ===
[[File:Scissors-locked-track-example.png|thumb]]
[[File:Scissors-locked-track-example.png|thumb]]
As seen to right, we have a oleo strut, and a gear leg. The oleo strut has a compression animation which uses a translate animation to move up or down according to gear-compression. There are two torque links - the top is called NLGTorqueLink1 and the bottom NLGTorqueLink2.
 
As seen to right, we have a oleo strut, and a gear leg. The oleo strut has a compression animation which uses a translate animation to move up or down according to gear-compression. There are two torque links - the top is called <code>NLGTorqueLink1</code> and the bottom <code>NLGTorqueLink2</code>.


The bottom link must be a child of the top link.  
The bottom link must be a child of the top link.  
After the translation animation, setup a locked track animation on NLGTorqueLink1. The center is the hinge of the top scissor arm, the target is the hinge of the bottom arm, target-name is the oleo strut which is translated. Finally, the slave-name is the bottom scissor arm, and the slave-center is where the two arms meet.
 
After the translation animation, setup a locked track animation on <code>NLGTorqueLink1</code>. The center is the hinge of the top scissor arm, the target is the hinge of the bottom arm, <code>target-name</code> is the oleo strut which is translated. Finally, the <code>slave-name</code> is the bottom scissor arm, and the <code>slave-center</code> is where the two arms meet.


<syntaxhighlight>
<syntaxhighlight>
Line 200: Line 201:


=== Scissors - without parenting ===
=== Scissors - without parenting ===
The same animation can be done without parenting.
The same animation can be done without parenting. The way this is animated is as follows:
The way this is animated is as follows:
 
Each torque link rotates around its base, where it meets the oleo strut / gear leg and is locked on the y-axis. The target position is at the 3D cursor, where both of them meet, and the track axis is the axis between the two centers of rotation of the torque links (about ten degrees off vertical). The target object is the other torque link (number 1 for number 2 and vice versa). The slave center is the center of rotation for the other torque link.
Each torque link rotates around its base, where it meets the oleo strut / gear leg and is locked on the y-axis. The target position is at the 3D cursor, where both of them meet, and the track axis is the axis between the two centers of rotation of the torque links (about ten degrees off vertical). The target object is the other torque link (number 1 for number 2 and vice versa). The <code>slave-center</code> is the center of rotation for the other torque link.


<syntaxhighlight>
<syntaxhighlight>
Line 274: Line 275:


===3 axis ''locked-track'' animation===
===3 axis ''locked-track'' animation===
 
Sometime is necessary realize the animation to an object with ball joint, is the typical case of a hydraulic jack actuate the opening the landing gear, it is necessary to proceed in two stages, ''as <code>locked-track</code> animation always needs at least a locked axis''.
Sometime is necessary realize the animation to an object with ball joint, is the typical case of a hydraulic jack actuate the opening the landing gear, it is necessary to proceed in two stages, '''as ''locked-track'' animation always needs at least a locked axis'''.


<gallery widths=640 heights=400>
<gallery widths=640 heights=400>
Line 281: Line 281:
</gallery>
</gallery>


First locks, for example, the '''Y''' axis and directs the object to a target object, in this example '' BOX_GEAR_GREEN.000 '' with coordinates: '' target-center ''. The '' track-axis '' is the axis that should point the target:
First locks, for example, the y axis and directs the object to a target object, in this example <code>BOX_GEAR_GREEN.000</code> with coordinates: <code>target-center</code>. The <code>track-axis</code> is the axis that should point the target:
<br>
<br>
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 312: Line 312:
</syntaxhighlight>
</syntaxhighlight>


Then write a second ''locked-track'', which should be put immediately under the first, which locks the axis '''X'''. Everything else is equal, as all other references are unchanged.
Then write a second <code>locked-track</code>, which should be put immediately under the first, which locks the x axis. Everything else is equal, as all other references are unchanged.


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 346: Line 346:


===The track-axis configuration===
===The track-axis configuration===
 
The <code>track-axis</code> is the real direction of the object that follows the target point. It is not very simple to configure as it also depends on the geometry of the piece. A very simple method for configure the axis direction is define it when the object is in the "rest" position, in essence in the position where the object is in the 3D file. When we activate the animation, even if we have correctly defined the center point and the target point, often the initial position of the object is not what we think is correct. At this point it is necessary to operate by varying the values of the free axes (Remember: the locked axis is the one defined in the lock-axis) until the piece assumes the correct initial position.
The track-axis is the real direction of the object that follows the target point. It is not very simple to configure as it also depends on the geometry of the piece. A very simple method for configure the axis direction is define it when the object is in the "rest" position, ie in the position where the object is in the 3D file. When we activate the animation, even if we have correctly defined the center point and the target point, often the initial position of the object is not what we think is correct. At this point it is necessary to operate by varying the values of the free axes (Remember: the locked axis is the one defined in the lock-axis) until the piece assumes the correct initial position.


===Tips===
===Tips===
====Graphic graph of coordinates of vertices of a line in angular coordinates according to the linear XYZ form====
====Graphic graph of coordinates of vertices of a line in angular coordinates according to the linear XYZ form====
 
Strangely, the coordinates of the <track-axis> section do not seem to work on the coordinates given in the form: <code><nowiki><x1-m> .. </ x1-m> ... <z2-m> .. </ z2-m ></nowiki></code>. We must give the coordinates in the form <code><nowiki><x> ... </ x> ... <z> .. </ z></nowiki></code>. To easily convert vertices, you can use the 3D CAD application FreeCAD. You create a line by inserting the two vertices (V1 and V2) and then activating the Bounding Box display, as shown in the figure. The 3 coordinates X, Y, Z can be used directly as x, y and z coordinates. But be careful with the signs.
Strangely, the coordinates of the <track-axis> section do not seem to work on the coordinates given in the form: <x1-m> .. </ x1-m> ... <z2-m> .. </ z2-m >. We must give the coordinates in the form <x> ... </ x> ... <z> .. </ z>. To easily convert vertices, you can use the 3D CAD application FreeCad. You create a line by inserting the two vertices (V1 and V2) and then activating the Bounding Box display, as shown in the figure. The 3 coordinates X, Y, Z can be used directly as X, Y, Z coordinates. But be careful with the signs.


<gallery widths=640 heights=400>
<gallery widths=640 heights=400>
File:FreeCad Bounding Box for Axis value conversion.jpg|Coordinates of vertices of a line convert in angular coordinates according to the XYZ form.
File:FreeCad Bounding Box for Axis value conversion.jpg|Coordinates of vertices of a line convert in angular coordinates according to the xyz form.
</gallery>
</gallery>


[[Category:Modeling]]
[[Category:Aircraft enhancement]]
[[Category:Aircraft enhancement]]

Navigation menu