Using SetData on Attached Objects

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

Postby boyblinky » Thu Mar 15, 2012 2:51 pm

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: 8
Joined: Tue Feb 21, 2012 6:26 pm

Postby boyblinky » Thu Mar 15, 2012 3:40 pm

Please disregard, AttachSimObjectToSimObject give the expected behavior.

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

Postby boyblinky » Tue Mar 20, 2012 6:09 pm

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

Postby Burkhard » Wed Mar 21, 2012 5:18 am

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

Postby WBard » Wed Mar 21, 2012 10:38 am

Thanks Burkhard for your reply!


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 3 guests