Mapping Joystick Trigger Button

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
Manoj S
Posts: 9
Joined: Sun Jul 02, 2023 5:25 am

Mapping Joystick Trigger Button

Post by Manoj S »

Hi,

How to map joystick trigger button using SIMCONNECT ? I'm receiving input from HAT button whenever it is operated, same way I'm trying to do with trigger button, but I'm not receiving any response.

Code: Select all

 // Reading input from HAT button
 
 	hr = SimConnect_MapClientEventToSimEvent(g_hSimConnect, EVENT_HAT);
        hr = SimConnect_AddClientEventToNotificationGroup(g_hSimConnect, GROUP_ID_COCKPIT, EVENT_HAT);
        hr = SimConnect_MapInputEventToClientEvent(g_hSimConnect, INPUT_HAT, "joystick:0:POV", EVENT_HAT);
        hr = SimConnect_SetInputGroupState(g_hSimConnect, INPUT_HAT, SIMCONNECT_STATE_ON);
        
// Reading input from Trigger button

	hr = SimConnect_MapClientEventToSimEvent(g_hSimConnect, EVENT_FIRE);
        hr = SimConnect_AddClientEventToNotificationGroup(g_hSimConnect, GROUP_ID_COCKPIT, EVENT_FIRE);
        hr = SimConnect_MapInputEventToClientEvent(g_hSimConnect, INPUT_FIRE, "joystick:0:button:1", EVENT_FIRE);
        hr = SimConnect_SetInputGroupState(g_hSimConnect, INPUT_FIRE, SIMCONNECT_STATE_ON);
Regards,
Manoj S
Manoj S
Posts: 9
Joined: Sun Jul 02, 2023 5:25 am

Re: Mapping Joystick Trigger Button

Post by Manoj S »

Hi

I got the solution. I was using Thrust Master Joystick, I mapped the joystick trigger button in N-1 configuration, N is the value received as a response from USB game controller when we press the trigger button. So I used "0" for trigger button it is working.

hr = SimConnect_MapInputEventToClientEvent(g_hSimConnect, INPUT_FIRE, "joystick:0:button:0", EVENT_FIRE);
Post Reply