Input

Humanoid Control provides an easy universal way to attach script functions to events and statuses. This is used for Controller Input, Hand Input and Foot Input.

Input Type

The first thing to select is what type of input handling you want. Input provides the following options:

  • GameObject This will enable you to call functions on GameObjects in the scene.
  • Animator This enables you to change Animation parameters based on input
  • PlayMaker (when available) Creates the possibility to call PlayMaker Actions

GameObject

The first parameter you can select is the GameObject on which you want to execute a function. If you want to execute a function on the object itself you have to select the object itself.
For example for Hand Input, if you want to execute a function on the Left Hand Target to which the Hand Input script is attached, you need to drag the Left Hand Target from the Hierarchy to the GameObject field:

To get back to the Input Type selection, the GameObject field should be cleared or set to null.

Function

The second parameter is the function you want to execute.

Functions can be executed on different components attached to the GameObject. The Component will be found before the actual function name, separated with a dot.
The following example lists all the available functions on a GameObject with a Light and an AudioSource component.

Input supports public functions without return values of various types.

Functions without parameters
public void MyFunction() { ... }

For these functions an additional parameter will appear which determines when the function is called:

  • Active The function is called while the status or event is active: while the object is touched, the controller button is pressed.
  • Inactive The function is called while the status or event is inactive: while no object is touched, the controller is not pressed.
  • Start The function is called when the status or event changes from active to inactive: at the moment an object is touch, the button is pressed.
  • End The function is called when the status or event changes from inactive to active: at the moment no object is touched anymore, the button is released.
  • Change The function is called when the status or event changes. So it is called for both Start and End.
Functions with one float parameter
public void MyFunction(float x) { ... }

For events with status values, like a trigger button value from 0-1 or a joystick position, the value will be directly passed on to the function.

For events without status values or boolean statuses, the function will be called with a 0 or 1 value, depending on the status of the event.

These functions will be called in each frame.

Functions with an enumeration of the first parameter
public enum MyEnum { A, B, C };
public void MyFunction(MyEnum e, float x) { ... }

For these function an additional parameter will appear listing the Enum values. This will determine the value which will be passed on to the function as the first parameter.

Animator

This option let you set animation parameters when an Animator has been set in Humanoid Control-Animator.

The following parameters are supported

  • Bool For events with status values, like a trigger button value from 0-1 or a joystick position, the value is true when the values if higher than 0.5.
  • Int Events without status or bolean values will be translated to 0/1 values. Float values will be truncated to an 0 or 1 integer value.
  • Float Events without status or bolean values will be translated to 0/1 values. Float values will be set directly
  • Trigger Will be set when the values goes from 0 to 1 or from false to true.

PlayMaker

This option is only available when PlayMaker is available in the project.

When an FSM has been attached to the Humanoid, it will list all available events available for that FSM.