# SetAxis

*int* **SetAxis**(*string* **description**, *string* **negative**, *string* **positive**, \[*float* **sensitivity**], \[*float* **gravity**], \[*float* **deadzone**])\
\&#xNAN;*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()`](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/methods/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](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/methods/axisinverted)).

You can optionally override the default [sensitivity](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/variables-and-properties/sensitivity), [gravity](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/variables-and-properties/gravity), or [deadzone](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/variables-and-properties/deadzone) of the axis by passing in `sensitivity`, `gravity`, and `deadzone` respectively. Additionally, you can use [`SetAxisSensitivity()`](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/methods/setaxissensitivity), [`SetAxisGravity()`](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/methods/setaxisgravity), and [`SetAxisDeadzone()`](https://cmonkeys.gitbook.io/cinput-reference-manual/script-reference/methods/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](https://cmonkeys.gitbook.io/cinput-reference-manual/using-cinput/a-brief-explanation-of-cinput).

## Example
