GetAxis

float GetAxis(string description)
float GetAxis(int descriptionHash)

Parameters

description: The name of the axis, as defined in SetAxis().
descriptionHash: The hashcode of the name of the axis, as defined in SetAxis().

Returns

float: A value between -1 and 1 inclusive.

Description

Returns the value of the axis.

Example

// move the transform horizontally with the "Horizontal Movement" axis float horizMovement = cInput.GetAxis("Horizontal Movement"); float h = 60 * horizMovement * Time.deltaTime; transform.Translate(h, 0, 0);

results matching ""

    No results matching ""