Possible Bug when using Avatar

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
obinder
Posts: 145
Joined: Sun Jun 08, 2014 9:43 am

Possible Bug when using Avatar

Post by obinder »

Hello @ll,

[Prepar3D 3.4.18.19475]

I am having an issue when the Avatar is chosen as my own vehicle ("Change vehicle -> Civilian male.."). If a SimConnect client is started, that tries to map client events, these fail for certain event IDs (Exceptions 7 initially and 1 when I try to trigger the events programmatically).

This effect seems to be limited to events that the Avatar as an object cannot support, for example:

simconnect.MapClientEventToSimEvent(EVENTS.TOGGLE_AIRCRAFT_EXIT, "TOGGLE_AIRCRAFT_EXIT");

will get me an exception "7".

If I start the scenario in an aircraft everything works normally, neither the event definitions nor the triggers throw exceptions. If I keep the SimConnect app running, and then switch to the Avatar (= as my own vehicle, not "Avatar mode"), everything continues to work as well.

Was this done on purpose, am I missing something in the docs? Am I using the Avatar incorrectly?

IMHO, this behaviour is incorrect. I should be allowed to map any SimConnect event id that I like - I intend to use them on other objects.

Best regards
Oliver Binder
LORBY-SI
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Possible Bug when using Avatar

Post by Clifton Crane »

Hi Oliver,

The reason you are seeing the exception when launching the SimConnect application with the Avatar as the user object is due to the fact that these native key events are not available to the Avatar. You would see this same behavior with any ISimObject implementation as they register their own events/properties and do not utilize all native key events.

The event registration will be successful when in a native vehicle with Avatar Mode enabled due to both the native and Avatar key events being available.

Would it be possible to delay the registration for these events until you are sure that the user is in a native SimObject?

Thanks.
Clifton Crane
Prepar3D® Software Engineer Sr.
obinder
Posts: 145
Joined: Sun Jun 08, 2014 9:43 am

Re: Possible Bug when using Avatar

Post by obinder »

Hello Clifton,

many thanks for your reply.

I can understand the reason, but not why it is treated as an Exception when mapping it. The external app connecting to the sim cannot know in advance if the user has chosen a "good" object or a "bad" one - and it might not even intend to use these events on that object at all. These events work on other sim objects too (for example AI aircraft), so they are in fact (and per spec) supposed to be independent of the user object.

The use case is like this: Imagine you start the sim as Avatar. On the airfield you will find all your own aircraft where you parked them. Now you walk up to one of them, and when you get close, it opens the doors - and on clicking a button you jump into the cockpit. Of course I can skip the doors bit, I just found it odd that a globally applicable event should be dependent on the user object.

If I may, I would suggest to throw an Exception when the external app actually triggers the event on an object that doesn't support it - but not when it is merely mapped to the definition.

Best regards
Oliver Binder
LORBY-SI
Locked