Skip to content

Commit

Permalink
wire up X55 buttons and rotarys
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjarv committed Mar 11, 2018
1 parent 1cdf04a commit 32e0128
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ public class SaitekX55Throttle : MonoBehaviour {
public GameObject LeftThrottle;
public GameObject RightThrottle;

public GameObject SW1_SW2;
public GameObject SW3_SW4;
public GameObject SW5_SW6;

public GameObject RTY3;
public GameObject RTY4;

public GameObject TGL1;
public GameObject TGL2;
public GameObject TGL3;
public GameObject TGL4;

// Use this for initialization
void Start()
{
Expand Down Expand Up @@ -45,9 +57,66 @@ void StickEvent(JoystickState state)
// Rotate Z between 0 and 20
LeftThrottle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, 0), 0, 0);
break;
case "Y": // Right brake
case "Y":
RightThrottle.transform.localEulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, 0), 0, 0);
break;

case "RotationY":
RTY3.transform.localEulerAngles = new Vector3(0, 0, ConvertRange(entry.Value, 0, 65535, -150, 150));
break;

case "RotationZ":
RTY3.transform.localEulerAngles = new Vector3(0, 0, ConvertRange(entry.Value, 0, 65535, -150, 150));
break;

case "Buttons5":
SW1_SW2.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons6":
SW1_SW2.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons7":
SW3_SW4.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons8":
SW3_SW4.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons9":
SW5_SW6.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons10":
SW5_SW6.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons11":
TGL1.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons12":
TGL1.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons13":
TGL2.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons14":
TGL2.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons15":
TGL3.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons16":
TGL3.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;

case "Buttons17":
TGL4.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : 30, 0, 0);
break;
case "Buttons18":
TGL4.transform.localEulerAngles = new Vector3(entry.Value == 0 ? 0 : -30, 0, 0);
break;
}
}
}
Expand Down
Binary file modified JoystickVisualizer/Assets/JoystickVisualizer.unity
Binary file not shown.
Binary file modified JoystickVisualizer/ProjectSettings/GraphicsSettings.asset
Binary file not shown.

0 comments on commit 32e0128

Please sign in to comment.