int SetAxis(string description, string negative, string positive, [float sensitivity], [float gravity], [float deadzone])
int SetAxis(string description, string action, [float sensitivity], [float gravity], [float deadzone])


description: The description of what the axis is used for.
negative: The action which provides the negative value of the axis.
positive/action: The action which provides the positive value of the axis.
sensitivity: Optional. The sensitivity for the axis. Defaults to 3.
gravity: Optional. The gravity for the axis. Defaults to 3.
deadzone: Optional. Input values below this level are ignored. Defaults to 0.001.


int: The hashcode of description.


Creates an axis out of one or two actions, which must have been set previously with SetKey(). If two actions are passed in, the first (negative) will be used to provide the negative values while the second (positive) will provide the positive values for the axis. If only one action is passed in (action) then the axis will only return positive values (unless inverted).

You can optionally override the default sensitivity, gravity, or deadzone of the axis by passing in sensitivity, gravity, and deadzone respectively. Additionally, you can use SetAxisSensitivity(), SetAxisGravity(), and SetAxisDeadzone() if you want to change these values for an axis after it has already been created.

Also note that setting up axes is not required and you should only do this if you require analog-like controls instead of digital controls. An axis input can be analog (e.g., joystick) or digital (e.g., keyboard button) or even a combination of the two. A virtual analog axis will be created if necessary. More details can be found in A Brief Explanation of cInput.


// uses "Left" and "Right" actions previously defined with SetKey to create a new axis cInput.SetAxis("Horizontal Movement", "Left", "Right"); // or the same as above but with increased sensitivity cInput.SetAxis("Horizontal Movement", "Left", "Right", 4.5f); // uses only a single input as an axis (e.g., for a gas pedal in a driving game) cInput.SetAxis("Acceleration", "Gas"); // or the same as above but with decreased sensitivity cInput.SetAxis("Acceleration", "Gas", 1.5f);

results matching ""

    No results matching ""