Using SetData on Attached Objects

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
boyblinky
Posts: 11
Joined: Tue Feb 21, 2012 6:26 pm

Post by boyblinky »

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!



boyblinky
Posts: 11
Joined: Tue Feb 21, 2012 6:26 pm

Post by boyblinky »

Please disregard, AttachSimObjectToSimObject give the expected behavior.
boyblinky
Posts: 11
Joined: Tue Feb 21, 2012 6:26 pm

Post by boyblinky »

Ok slight update. Does this only work when attaching to the player's own aircarft? It doesn't seem to function on "AI" aircarft.
Burkhard
Posts: 185
Joined: Tue Nov 22, 2011 7:51 am

Post by Burkhard »

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.
WBard
Posts: 1034
Joined: Mon Aug 16, 2010 7:23 pm

Post by WBard »

Thanks Burkhard for your reply!
Locked