SetAxis
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])
Parameters
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
.
Returns
int: The hashcode of description
.
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.
Example
Last updated