Howto:Animate models: Difference between revisions

Jump to navigation Jump to search
m
rewrite the 2020.4 axis animation object explanation because my last attempt was terrible.
m (documented 2020.4 tags for axis objects)
m (rewrite the 2020.4 axis animation object explanation because my last attempt was terrible.)
Line 119: Line 119:
If the <code><axis>...</axis></code> section is omitted entirely, <code>{object-name}-axis</code> will be used by default, where <code>{object-name}</code> is the name of the object being animated (if we are animating more than one object, the first object is used). In the earlier example this would be <code>Rudder-axis</code>.
If the <code><axis>...</axis></code> section is omitted entirely, <code>{object-name}-axis</code> will be used by default, where <code>{object-name}</code> is the name of the object being animated (if we are animating more than one object, the first object is used). In the earlier example this would be <code>Rudder-axis</code>.


With FG <= 2023.3 the order of the points in the vertex will be sorted based on their X coordinate and when the X coordinate is equal the order will be that of the vertices in the model. Since 2020.4 it has been possible to add the tag <code><order-by-xyz/></code> to the <code><axis></code> element to specify that all axes are used to sort which produces consistent results. This behaviour can be specified for an entire model by including the tag
==== Vertex Ordering ====
<code><axis-animation-vertex-order-xyz/></code> usually in the top level model.xml; although it can be specified in any model XML and will affect that XML and any children that don't explicitly set the order. Generally I would consider it better practice to only set this once. It is also possible to use the tag <code><axis-animation-vertex-order-x/></code> and this might be useful where a particular model requires this.
 
With FG <= 2023.3 the order of the points in the vertex will be sorted based on their X coordinate and when the X coordinate is equal the order will be that of the vertices in the model.  
 
This has been improved in 2020.4 by adding some new tags that can be used in the <axis> section.
 
# <order-by-xyz/> - use the new sorting rules
# <order-by-x/> - use the 2020.3 sorting rules
# <swap-axis-direction/> - when the animation goes the wrong way this is an elegant way to fix it.
 
There is also a new top level tag <defaults> that can have either <axis-animation-vertex-order-xyz/> or <axis-animation-vertex-order-x/>. These defaults will affect all animations in the .xml and also any included models unless the included model also has a <defaults> section.
 
So for modelers that want to use the new definitive vertex sorting rules adding the following to the main model is sufficient.
<source>
    <defaults>
        <axis-animation-vertex-order-xyz/>
    </defaults>
</source>
 
==== Adding the axis animation 3d object to a model ====


In the '''.ac''' file, specify a SURF with type (bottom 4 bits, 0=polygon, 1=closedline, 2=line) set to 2, and two vertices that define the axis. For example:
In the '''.ac''' file, specify a SURF with type (bottom 4 bits, 0=polygon, 1=closedline, 2=line) set to 2, and two vertices that define the axis. For example:
308

edits

Navigation menu