Reversed propeller animation.

Daisuke Iga

Introduction

Some of twin-engined planes have CCW rotating propellers to counter torque effect. P-38, Me410, Ki-64 just named a few. Many FS flight dynamics engineers made efforts to simulate this but in vain until CFS2 appeared.

CFS2 lets you design CCW propeller characteristics by simply editing aircraft.cfg file. In an aircaft.cfg file, you only need add "-1" to the engine you wish to rotate CCW. But if you have a close look at the CCW prop, you'll find the props show not the way you want. CW propellers works perfectly, but CCW prop just sits there even at higher rotating speed. Transparent disk does not appear even at the highest RPM. This side effect can be solved by manually change the BGL code inside the 3D model. I'll explain step-by-step procedure I used.

Notice:
This document describes the method to de-compile and manual edit any existing aircraft. It is deemed as reverse engineering. I disclaim any responsibility caused by this document. Please bare in mind that any aircraft could be an intellectual creation and a subject of copyright. Unless otherwise you have an authorization, it could be unlawful to modify copyrighted materials. Besides these legalistic matter, it is often considered dishonorable to simply duplicate someone else's creation and claim as yours. 

CCW propeller error - Why it happens?

Before we go to the detail, I think it's good time to know how the prop animation is defined in the 3D model. If you prefer a quick start, you may skip this part since I will show practical method later.

I'm assuming that propellers are animated with Aircraft Animator. If they aren't, this document may not help. Any animation is built inside the *.mdl file of each aircraft. *.mdl files are binary files and hard to understand. But once you reverse compile the binary code, it will become a readable, still huge lines of programming commands. This programming command set is called SCASM source code. If you are familiar with programming language, it is similar to the relationship of source codes and compiled executables.

Let's have  a look at a source code generated by AA for propeller animations. Disassemble the plane in concern with MdlDisas.exe. You will find the IfVarRange command comes with actual drawing codes of propellers in the source code. It should go like below.

IfVarRange( :L0190D0 50 -32767 4914 )

    :
    :
    :

:L0190D0

*** Drawing Codes for propeller ***

IfVarRange is a command that jumps to a given label if a given valuable is in a given range. The first hexadecimal number between the brackets is the label. Label is an index to a block of SCASM codes. The block can be a wing part, a cockpit part or any drawing codes for any part of the aircraft. The second is the variable. In this example, 50, is the variable for the Engine 1 RPM. The 3rd and 4th are minimum and maximum value of the range for the variable in concern. As far as I know, the minimum and maximum most probably can be -32768 and 32768, that accounts for -100% and 100% of Engine 1 RPM. The example above means "Draw the propeller part in label :L0190D0 if the variable 50 or, Engine 1 RPM is between the range from -32768 to 4096". Now you see how AA's prop motion sequence is translated into SCASM codes.

Let's use my own build Hs129B2 as an example. I made 3-blade prop set for low RPM, that appears from 0% to 30%, and a translucent disk for high RPM, from 30% to 100%. You most probably think that the SCASM source code should go like below. Note, 4914 is not 30% of 32786 but 15%. I don't know why but 4914 is the magic number for 30% threshold. 

IfVarRange( :L0190D0 50 0 4914 )
 ; Determines low RPM propeller visible range.
IfVarRange( :L0290D0 50 4914 32768)
 
; Determines high RPM propeller visible range.

    :
    :
    :

:L0190D0

*** Drawing Codes for low RPM propeller ***

:L0290D2

*** Drawing Codes for high RPM propeller ***

But actually, AA generates codes like below for propeller animation sequence with threshold placed at 30%.

IfVarRange( :L0190D0 50 -32768 4914 )
 
; Determines low RPM propeller visible range.
IfVarRange( :L0290D0 50 4914 32768)
 ; Determines high RPM propeller visible range.

    :
    :
    :

:L0190D0

*** Drawing Codes for low RPM propeller ***

:L0290D2

*** Drawing Codes for high RPM propeller ***

See? As far as I have examined, AA always sets the minimum value for IfVarRange command to -32768 or, -100%, not zero for propeller animations. This is the point. Please keep this in mind and proceed.

When you finished AA, you are going to edit the aircraft.cfg and make the engine rotate CCW by adding "-1" sign. By doing so, CFS2 multiplies -1 to the actual rotating speed of the engine. For example, when you run the CCW engine at 50% RPM, CFS2 recognizes that you are running it at -50%. As the propellers rotate proportional to the engine speed, they rotate -50% speed or, 50% CCW. This is how the CCW propeller animation is achieved by the aircraft.cfg setting.

Here is the vital part. After you add -1 to aircfraft.cfg, the variable will receive the rotating speed multiplied by -1. If you are running the engine at 50%, the variable receives -50%. With this in mind, look at the above SCASM code again. 

IfVarRange( :L0190D0 50 -32768 4914 )
 
; Low RPM propeller. Visible from -100% to 30%.
IfVarRange( :L0290D0 50 4914 32768)
 
; High RPM propeller. Visible from 30% to 100%.

    :
    :
    :

:L0190D0

*** Drawing Codes for low RPM propeller ***

:L0290D2

*** Drawing Codes for high RPM propeller ***

Since your engine is running at -50% RPM, the first IfVarRange command always take you to the label :L0190D0. Label :L0290D2 can not be reached since second IfVarRange command only works when the variable 50, or Engine 1 RPM is in the range from 30% to 100%. This means low RPM propeller always appears but high RPM propeller never! Now you see why propeller does not show up properly when the rotation is inverted.

The solution

The solution is simple. You need to change the minimum and maximum value for the variable to meet the propeller animation sequences. For example, if you want the low RPM propellers and high RPM propellers appear from 0% to 30% and from 30% to 100% respectively, your SCASM codes go like below.

IfVarRange( :L0190D0 50 -4914 32768 )
 
;low RPM propeller. Visible from -30% to 100%.
IfVarRange( :L0290D0 50
-32768 -4914)
 
; High RPM propeller. Visible from -100% to -30%.

    :
    :
    :

:L0190D0

*** Drawing Codes for low RPM propeller ***

:L0290D2

*** Drawing Codes for high RPM propeller ***

If you are familiar with hand coding SCASM, I think you get it. For people who are not so familiar with, I'll show you a step-by-step procedure.

Continue: Practical method.