Skip to main content

Getting input

namespace: qASIC.InputManagement

Getting actions

To get the value of an action, call one of the GetInput methods.

public void Example()
{
//True on the first frame the action was activated
InputManager.GetInputDown("jump");
//True while the user is holding down the action
InputManager.GetInput("jump");
//True on the last frame the user was holding down the action
InputManager.GetInputUp("jump");

//You are also able to specify groups
InputManager.GetInputDown("UI", "console");
}

Getting axes

To get the value of an axis, call one of the GetMapAxis methods.

public void Example()
{
//Returns the axis ranging between -1 and 1
InputManager.GetMapAxis("horizontal");
//Returns the raw axis that can be equal -1 0 or 1
InputManager.GetMapAxisRaw("vertical");

//You are also able to specify groups
InputManager.GetMapAxis("car", "horizontal");
InputManager.GetMapAxisRaw("car", "vertical");
}

Creating axes

Axes can be created during runtime by calling one of the CreateAxis methods.

public void Example()
{
//Creating an axis from actions
InputManager.CreateAxis("forward (positive)", "backward (negative)");

//Creating an axis from key codes
InputManager.CreateAxis(KeyCode.W, KeyCode.S);

//Creating an axis from booleans
InputManager.CreateAxis(Input.GetKey(KeyCode.W), Input.GetKey(KeyCode.S));
}