I want to enable the smoke system on an attached object. However, my current setup doesn't seem to work. Here's what I am doing...
1st - call AddDataDefinition to map "SMOKE ENABLE"
2nd - call AttachObjectToSimObject to attach object to user aircraft.
3rd - remove AIConrol from newly created and attached object.
4th - use the setData method to enable smoke on attached object.
I can see the attached object, and it follows the user aircraft correctly. No smoke can be seen though. The attached object is a flyable aircraft with a smoke system. If I load the attached object and fly it, I can enable the smoke through the keyboard just fine.
Is there a step I am missing or is it just not supported?
Thanks!
Using SetData on Attached Objects
If an AI aircraft has smoke in the config, you can switch it on and off using
simconnect.RequestDataOnSimObject(DATA_REQUESTS.REQUEST_SMOKE, DEFINITIONS.Smoke1, id, SIMCONNECT_PERIOD.ONCE, 0, 0, 0, 0);
and on the callback I use
case DATA_REQUESTS.REQUEST_SMOKE:
Smoke1 s3 = (Smoke1)data.dwData[0];
if (s3.smoke_enable)
{
button3.Text = "Enable Smoke";
s3.smoke_enable = false;
}
else
{
s3.smoke_enable = true;
button3.Text = "Disable Smoke";
}
simconnect.SetDataOnSimObject(DEFINITIONS.Smoke1, id, 0, s3);
break;
to toggle smoke with one buttom.
simconnect.RequestDataOnSimObject(DATA_REQUESTS.REQUEST_SMOKE, DEFINITIONS.Smoke1, id, SIMCONNECT_PERIOD.ONCE, 0, 0, 0, 0);
and on the callback I use
case DATA_REQUESTS.REQUEST_SMOKE:
Smoke1 s3 = (Smoke1)data.dwData[0];
if (s3.smoke_enable)
{
button3.Text = "Enable Smoke";
s3.smoke_enable = false;
}
else
{
s3.smoke_enable = true;
button3.Text = "Disable Smoke";
}
simconnect.SetDataOnSimObject(DEFINITIONS.Smoke1, id, 0, s3);
break;
to toggle smoke with one buttom.