When the left wing hits the ground or the airspeed exceeds 250 kts, the wing should get damaged. This could easily be implemented using a <switch>:
- Code: Select all
<switch name="Left wing damage">
<output>damage/left-wing</output>
<default value="damage/left-wing"></default>
<test logic="OR" value="1">
contacts/unit[3]/compression-ft gt 1
/velocities/airspeed-kt gt 250
</test>
</switch>
But naturally, the wing won't suddenly break away when you go over 250 kts - rather, the damage increases with increasing airspeed. Solution is to use an <fcs_function> with a <table>:
- Code: Select all
<fcs_function>
<function>
<table>
<independentVar lookup="row">/velocities/airspeed-kt</independentVar>
<independentVar lookup="column">contacts/unit[3]/compression-ft</independentVar>
<tableData>
0 1 2
0 0 0 1
250 0 1 1
300 1 1 1
</tableData>
</table>
</function>
</fcs_function>
But now, the damage disappears again as soon as the airspeed decreases again or the wing is lifted off the ground again. That's not how it would be in reality.
So, I need some combination of the two. Is that possible, or will I have to use some Nasal code (that would be easy) ?
.