Controller Input

Setup

The Controller Input script can be used to assign functions to various controller and keyboard input events.

Controller Type This selects which controller type is showed. This helps to determine how the actions are assigned to buttons or various supported controllers. Controller Type Keyboard is special because that enables you to assign keyboard key presses to function calls instead of controller buttons.

Controllers

When Controller Type is set to anything but Keyboard, you can assign controller buttons to certain functions. Controller input is split into a left and right side. For some controllers, this corresponds to the left or right controller (e.g. SteamVR or Oculus Touch controllers). For game controllers like the Xbox Controller, this corresponds to the left and right side of the gamepad.

Note that all controllers use the assignment and setting the Left Vertical Input for one controller also changes the Left Vertical input for all other contollers. Inputs on the same line of the editor of each controller are the same.

For each controller input line you can select different targets:

-Empty- No function is assigned to this input.
Humanoid Functions which work on the humanoid avatar as a whole like walking around and rotating.
Head or Hands Functions which work on the targets like rotating the head or changing the pose of the hand.
Animator When an animator controller is selected in Humanoid Control script you will be able to change the Animation Parameters to trigger state changes in the Animation State Machine.

When a target has been selected, it is possible to select the member function or animation parameter for that target. If the member function has a enumeration parameter, you will be able to select a value for the enumeration. An example of this is the SetHandPose member function on the Left or Right Hand target.

When the built-in member functions do not suit your needs, you can define your own functions by adding a component script to the Humanoid or Humanoid Targets. The following member function types are supported and will be added automatically when added to the script:

  • functions without parameters and return values, e.g.: public void F1()
  • functions with one float parameters and no return values, e.g. public void F2(float x)
  • functions with an enumeration as the first parameter and a float as the second parameter and no return values, e.g. public void F3(Enumeration e, float x) and with public enum Enumeration { A, B, C }. The values A, B and C will then be shown in the input controller line when this member function is selected.