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.
Avatar control
Re: Avatar control
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.
I still need to know how to do walk, turn left, turn right.
-
- Lockheed Martin
- Posts: 1207
- Joined: Tue Sep 25, 2012 2:34 pm
Re: Avatar control
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!
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 Sr.
Prepar3D® Software Engineer Sr.
Re: Avatar control
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
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
-
- Lockheed Martin
- Posts: 1207
- Joined: Tue Sep 25, 2012 2:34 pm
Re: Avatar control
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.
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 Sr.
Prepar3D® Software Engineer Sr.
Re: Avatar control
Hello Clifton,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.
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);
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