Let me explain the situation from a code point of view.
DB3 top gunner pits exchange the fuselage material in the "old fashioned" way, in the "reflectWorldToInstruments" method:
public void reflectWorldToInstruments(float f) {
HierMesh hierMesh = aircraft().hierMesh();
Mat mat = hierMesh.material(hierMesh.materialFind("Gloss1D0o"));
this.mesh.materialReplace("Gloss1D0o", mat);
}
IL-4 top gunner pit has the modern version of this code.
In that newer code version, the material change happens in a "reflectPlaneMats" method.
But since this method never gets called directly by the base cockpit class, a variable "bNeedSetUp" got introduced, which makes sure that
on first update of the cockpit, the material replacement method gets called.
This is the way used for many aircraft, it always works.
To make matters visible, I've added a few log output codes to the IL-4 top gunner pit, see source below:
public void reflectWorldToInstruments(float f)
{
if(bNeedSetUp)
{
System.out.println("### CockpitIL4_TGunner reflectWorldToInstruments(" + f + "), bNeedSetUp=true");
prevTime = Time.current() - 1L;
bNeedSetUp = false;
System.out.println("### CockpitIL4_TGunner reflectWorldToInstruments(" + f + "), calling reflectPlaneMats(), bNeedSetUp=" + bNeedSetUp);
reflectPlaneMats();
}
}
protected void reflectPlaneMats()
{
HierMesh hiermesh = aircraft().hierMesh();
Mat mat = hiermesh.material(hiermesh.materialFind("Gloss1D0o"));
System.out.println("### CockpitIL4_TGunner reflectPlaneMats(), mat=" + (mat==null?"null":""+mat.hashCode()));
mesh.materialReplace("Gloss1D0o", mat);
}
public CockpitIL4_TGunner()
{
super("3DO/Cockpit/DB3-TGun/TGunnerIL4.him", "he111_gunner");
bNeedSetUp = true;
prevTime = -1L;
prevA0 = 0.0F;
hook1 = null;
System.out.println("### CockpitIL4_TGunner <init>, bNeedSetUp=" + bNeedSetUp);
}
And this is the result:
[2023-02-24 07:36:33.699 UTC +1] dT: 0 ### CockpitIL4_TGunner <init>, bNeedSetUp=true
[2023-02-24 07:36:37.000 UTC +1] dT: 51 ### CockpitIL4_TGunner reflectWorldToInstruments(0.4), bNeedSetUp=true
[2023-02-24 07:36:37.000 UTC +1] dT: 0 ### CockpitIL4_TGunner reflectWorldToInstruments(0.4), calling reflectPlaneMats(), bNeedSetUp=false
[2023-02-24 07:36:37.001 UTC +1] dT: 0 ### CockpitIL4_TGunner reflectPlaneMats(), mat=4734828
As expected, all code works fine and the material gets replaced successfully.
No clue why this doesn't work for those who witness the green fuselage, and even more, why it only fails to work on the IL-4 but not on the hundreds of other aircraft that use the same coding scheme.
Mike