Avatar control

rsubers2
Posts: 64
Joined: Thu Sep 20, 2012 10:42 pm

Avatar control

Postby rsubers2 » Thu Nov 22, 2018 2:53 pm

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.

rsubers2
Posts: 64
Joined: Thu Sep 20, 2012 10:42 pm

Re: Avatar control

Postby rsubers2 » Fri Nov 23, 2018 6:15 pm

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.

Clifton Crane
Lockheed Martin
Posts: 975
Joined: Tue Sep 25, 2012 2:34 pm

Re: Avatar control

Postby Clifton Crane » Tue Dec 04, 2018 3:35 pm

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!
Clifton Crane
Prepar3D® Software Engineer

obinder
Posts: 115
Joined: Sun Jun 08, 2014 9:43 am

Re: Avatar control

Postby obinder » Tue Dec 04, 2018 5:52 pm

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

Clifton Crane
Lockheed Martin
Posts: 975
Joined: Tue Sep 25, 2012 2:34 pm

Re: Avatar control

Postby Clifton Crane » 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.
Clifton Crane
Prepar3D® Software Engineer

obinder
Posts: 115
Joined: Sun Jun 08, 2014 9:43 am

Re: Avatar control

Postby obinder » Wed Dec 05, 2018 5:02 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


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 1 guest