For anyone interested in improving the rain code that we currently do in nasal. If your aircraft is jsbsim, you can get the rain code out of nasal and use FDM functions and XML in its place. I just finished setting up the c172p this way. It is every bit as flexible and seems to be much smoother. I think this example code can be improved considerably, which I plan to do eventually.
First
- Code: Select all
<system name="c172p-glass-effects">
<channel name="rain">
<fcs_function name="glass-effects/splashx">
<function>
<difference>
<value>-0.1</value>
<product>
<value>2.0</value>
<sqrt>
<quotient>
<min>
<property>/velocities/airspeed-kt</property>
<value>40</value>
</min>
<value>40</value>
</quotient>
</sqrt>
</product>
</difference>
</function>
</fcs_function>
<fcs_function name="glass-effects/splashz">
<function>
<difference>
<value>1.0</value>
<product>
<value>1.35</value>
<sqrt>
<quotient>
<min>
<property>/velocities/airspeed-kt</property>
<value>40</value>
</min>
<value>40</value>
</quotient>
</sqrt>
</product>
</difference>
</function>
</fcs_function>
</channel>
</system>
And then a property rule
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<filter>
<name>splashX</name>
<type>gain</type>
<input>
<property>/fdm/jsbsim/glass-effects/splashx</property>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-x</property>
</output>
</filter>
<filter>
<name>splashY</name>
<type>gain</type>
<input>
<value>0.0</value>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-y</property>
</output>
</filter>
<filter>
<name>splashZ</name>
<type>gain</type>
<input>
<property>/fdm/jsbsim/glass-effects/splashz</property>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-z</property>
</output>
</filter>
</PropertyList>
That's all there is to it.
The areas for improvement is to have a "max" on the lower end of the airspeed. The low end of the original nasal function acted strange in my opinion. Also I think a "switch" is needed for when the prop is turned on/off.
Kansas(2-27-15)/
Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480