|
If you carefully examine the object source code file for an aircraft model, you'll notice a consistent pattern for part rendering, a pattern that applies to fixed and animated parts alike.
Parts created in FSDS without the Display Condition "Part Visible" produce the following pattern ...
; Part: name
:PartName
Transform_Mat(
X Z Y ;Floating point coordinates of part reference axis
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
)
SetMaterial( [mat index] [texture index] ) ;Set part material and/or texture bitmap
DrawTriList( start ;Draw part triangle polygons
v0 v1 v2
.. .. ..
vn1 vn2 vn3
)
TransformEnd ;End of part transformation
Return ;Finished with this part ... Return
Parts created in FSDS with the Display Condition "Part Visible," the pattern looks like this ...
; Part: name
:PartName
IfVarAnd( :ReturnLabel 90 8 ) ;Part visibility test
Jump( :GO_ON ) ;Part is visible
:ReturnLabel
Return ;Part is not visible
:GO_ON
Transform_Mat( ;Reorient part reference axis if needed
X Z Y ;Floating point coordinates of part reference axis
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
)
SetMaterial( [mat index] [texture index] ) ;Set part material and/or texture bitmap
DrawTriList( start ;Draw part triangle polygons
v0 v1 v2
.. .. ..
vn1 vn2 vn3
)
TransformEnd ;End of part transformation
Return ;Finished with this part ... Return
SCASM lets you access directly the animation-related parameters used in CFS2 that will tell you exactly where each part is in space at a given time.
Here are the animation-related parameters available for you to work with:
| CFS2 Animation Parameters |
| Offset | Animation Data |
| 0x6E | Left aileron position |
| 0x70 | Right aileron position |
| 0x72 | Left flap position |
| 0x74 | Right flap position |
| 0x76 | Elevator deflection angle |
| 0x78 | Rudder deflection angle |
| 0x98 | Extension / retraction of left gear, including compression. |
| 0x9C | Extension / retraction of right gear, including compression. |
| 0xA0 | Extension / retraction of center gear, including compression. |
| 0xA4 | Engine 1 Prop position (angle). |
| 0xA6 | Engine 1 RPM. |
| 0xA8 | Engine 2 Prop position (angle). |
| 0xAA | Engine 2 RPM. |
| 0xAC | Engine 3 Prop position (angle). |
| 0xAE | Engine 3 RPM. |
| 0xB0 | Engine 3 Prop position (angle). |
| 0xB2 | Engine 4 Prop position (angle). |
| 0xB4 | Steer angle of center wheel. |
| 0xB8 | If non-zero, model should check for crash with user aircraft. Set to non-zero for AI aircraft. |
| 0xBA | Percentage of left wing fold, e.g. CFS2 Corsair. |
| 0xBE | Percentage of left wing fold, e.g. CFS2 Corsair. |
| 0xC2 | Cowl flap position for engine 1. Recommended you use cowl_flaps0. |
| 0xC6 | Primary exit, door, or canopy percentage open. |
| 0xCA | Secondary exit, door, or canopy percentage open. |
| 0xCE | Primary exit, door, or canopy percentage open. |
| 0xD2 | Secondary exit, door, or canopy percentage open. |
| 0xD6 | Primary exit, door, or canopy percentage open. |
| 0xDA | Secondary exit, door, or canopy percentage open. |
| 0xDE | Percentage tail hook is extended. |
| 0xE2 | Percentage bomb bay is open. |
| 0xEA | Position of center wheel rotation. |
| 0xEE | Position of left wheel rotation. |
| 0xF2 | Position of right wheel rotation. |
NOTE
 |
The above offsets may not reflect the actual values for your model! Be sure to check the content of your VarTable.txt file, which is located in your Abacus Design Studio folder.
| |
Stock Animation
The key to modifying the object source code for stock animation is the SCASM command ...
TransformCall( :Labelname delta_x delta_y delta_z x_deg xvar z_deg zvar y_deg yvar )
To use the TransformCall( ... ) command, simply take the delta_x delta_y delta_z values directly from the Transform_Mat( ... ) command and use them as integers in the TransformCall( ... ) command.
For example, the FSDS-generated object code for the rudder in fxanimate.sca is,
Transform_Mat(
0.000000 -14.935200 -226.466400
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
)
The delta_x delta_y delta_z values are; 0 -15 -226.
In order to animate this rudder, we need to know the correct rudder position, or deflection angle. CFS2 carries this data in the variable at offset 0x78 (see above). Thus, the value for yvar is 0x78.
Since the rudder axis always remains parallel to its rotation axis, y-deg will remain 0.00000.
Now we have the final command line ...
TransformCall( :RudderAnim 0 -15 -226 0.00000 0x00 0.00000 0x00 0.00000 0x78 )
If the animated part has "child" parts, then the TransformCall ( ...) command has to be applied to each of those parts in turn using the same CFS2 parameter you applied to the primary "parent" part.
Put another way, if you are animating the rudder and it has eight "children," say eight bullet hole polygons, then you have to apply the TransformCall ( .. ) to each bullet hole polygon as well. The CFS2 parameter will remain the same in each case. Only the delta_x delta_y delta_z values will change to reflect the part axis location for each bullet hole polygon.
This is necessary so that each "child" part remains linked to its parent during animation and moves exactly in sync with the parent when the parent moves!
Keyframe Animation
The key to modifying the object source code for keyframe animation is the SCASM command ...
Animate( vinput_base vinput vtable_base t_offset xlat_x xlat_z xlat_y )
which animates objects using the keyframe data tables built into the model file.
NOTE
 |
FSDS Pro version 2.33 automatically includes keyframe animation tables when generating the object source code file (.sca) for your model!
| |
You can learn quite a bit about the animation process by examining examples of SCASM animations. The following animations are taken from the object source code file fxanimateSFX.sca created with FSDS Pro v2.33.
Ailerons
Flaps
Canopy
Landing Gear
Landing Gear Tires
Wheel Steering
Elevator
Rudder
Cowl Flaps
Propeller
Folding Wings
Tailhook
Bullet Hole
Each animation includes both the original and edited versions of the object source code for comparison.
|