I want to open another Camera view from my SimConnect Client app. As no Camera API Events are working I thought that maybe sending a keystroke would work. When I am in the airplane cockpit and hit CTRL+6 I can open the OVH view in the cockpit. Can I send the “CTRL+6” from the SimConnect?
Hello @sloppy99,
We have no Simconnect function that can send key events to the sim.
However, there are several simvars you can use to work with cameras.
For your purpose, you can try this code :
static enum DATA_DEFINE_ID
{
CAMERA_STATE,
CAMERA_CATEGORY_INDEX,
CAMERA_SUBCATEGORY_INDEX
};
struct CameraIndex
{
double state;
double category_index;
double subcategory_index;
};
//Here we define our simvars
SimConnect_AddToDataDefinition(hSimConnect, CAMERA_STATE, "CAMERA STATE", "enum");
SimConnect_AddToDataDefinition(hSimConnect, CAMERA_CATEGORY_INDEX, "CAMERA VIEW TYPE AND INDEX:0", "enum");
SimConnect_AddToDataDefinition(hSimConnect, CAMERA_SUBCATEGORY_INDEX, "CAMERA VIEW TYPE AND INDEX:1", "number");
camera.state = 2; // 2 is for the cockpit view
camera.category_index = 3; //3 is for Quickview Category
camera.subcategory_index = 5;// 5 is for the 6th Quickview camera's index
// Here we set the simvars
SimConnect_SetDataOnSimObject(hSimConnect, CAMERA_STATE, SIMCONNECT_OBJECT_ID_USER, 0, 0, 8, &camera.state);
SimConnect_SetDataOnSimObject(hSimConnect, CAMERA_CATEGORY_INDEX, SIMCONNECT_OBJECT_ID_USER, 0, 0, 8, &camera.category_index);
SimConnect_SetDataOnSimObject(hSimConnect, CAMERA_SUBCATEGORY_INDEX, SIMCONNECT_OBJECT_ID_USER, 0, 0, 8, &camera.subcategory_index);
Of course, you can set different values for your camera. I strongly recommand to read this page wich documents all the camera SimVars.
Also please note that all the cameras are depending on the aircraft you are using. You can set them in the Aircraft Editor under the “Camera” Section.
Hope this could help,
Regards,
Alexandre
Thanks for your response and info:) But, the “this page” link in your response doesn’t work.
I found the info here: Camera Variables