Page 1 of 1

Avatar control

Posted: Thu Nov 22, 2018 2:53 pm
by rsubers2
I am looking at controlling the Avatar from an external SimConnect client (i.e. an exe). I want to be able to position it (lat, lon) and do control functions (walk, turn left, turn right).

For the former if I use plane lat/lon that controls the plane. I suspect I need an object ID for the Avatar and use SetDataOnSimObject but do not see how to get the object ID. I do not see a SIMOBJECT TYPE of Avatar in the SIMOBJECT_TYPE enum.

Also how do I go about issuing commands? I do not see key commands for avatar actions in the key commands documentation.

Re: Avatar control

Posted: Fri Nov 23, 2018 6:15 pm
by rsubers2
I figured out how to find the Avatar object ID, do a SimConnect_RequestDataOnSimObjectType with a short radius and SIMCONNECT_SIMOBJECT_TYPE_ALL with a data definition containing CATEGORY and look for a category of Avatar.

I still need to know how to do walk, turn left, turn right.

Re: Avatar control

Posted: Tue Dec 04, 2018 3:35 pm
by Clifton Crane
Hi rsubers2,

For movement, you should be able to trigger the key events as seen in the controls Key Assignments and Axis Assignments and UI:

For example:
Avatar - Move Forward (down)
Avatar - Move Forward (up)

The "down" event would begin movement, the "up" event would end movement. The events can also be found in the DefaultControlMap.xml file in the Avatar SimObject's Controls directory.

Triggering the event can be done via SimConnect or PDK.

Hope this helps!

Re: Avatar control

Posted: Tue Dec 04, 2018 5:52 pm
by obinder
Hello Clifton,

but that only seems to work on your own Avatar (SIMCONNECT_OBJECT_ID_USER). It does not trigger the Animations on an additional Avatar simobject that was created via SimConnect.AiCreateSimulatedObject. It would be very interesting to know if this is an error on my part or intended behavior.

Btw. I can't find these Avatar key events in the spec / Learning Center?

Best regards

Oliver Binder
Lorby-SI

Re: Avatar control

Posted: Tue Dec 04, 2018 8:59 pm
by Clifton Crane
Hi Oliver,

Unfortunately these events aren't currently documented. In your Simconnect call, rather than use SIMCONNECT_OBJECT_ID_USER you should be able to use the object ID of the Avatar you are attempting to move.

Re: Avatar control

Posted: Wed Dec 05, 2018 5:02 pm
by obinder
Clifton Crane wrote: Tue Dec 04, 2018 8:59 pm Hi Oliver,

Unfortunately these events aren't currently documented. In your Simconnect call, rather than use SIMCONNECT_OBJECT_ID_USER you should be able to use the object ID of the Avatar you are attempting to move.
Hello Clifton,

no, unfortunately that doesn't work. The simobject Avatar can idle and he will fall, but he can't walk. Moving him programmatically in any way possible will not trigger the animations, and he doesn't react to the key events.

Code: Select all

                simconnect.MapClientEventToSimEvent(EVENTS.AVATAR_FORWARD, "Avatar - Move Forward (down)");
                simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP0, EVENTS.AVATAR_FORWARD, false);
                ….
              
                simconnect.TransmitClientEvent(this.selectedAsset.objectId, EVENTS.AVATAR_FORWARD, 1, NOTIFICATION_GROUPS.GROUP0, SIMCONNECT_EVENT_FLAG.DEFAULT);
                  

... does nothing.

If this would be possible, it would really be something. I am in the process of writing a programmatic animation controller for this purpose, but if it could be done with the events, that would save a ton of work.

Best regards
Oliver Binder
Lorby-SI