Skip to main content

Class: Axis2dAction

Defined in: input/actions/axis-2d-action.ts:10

An action that represents a 2-dimensional axis input, such as a joystick or mouse position.

Implements​

Constructors​

Constructor​

new Axis2dAction(name, inputGroup?, actionResetType?): Axis2dAction

Defined in: input/actions/axis-2d-action.ts:30

Creates a new Axis2dAction.

Parameters​

name​

string

The name of the action.

inputGroup?​

string

The input group this action belongs to.

actionResetType?​

ActionResetType = actionResetTypes.zero

The type of reset behavior for this action. Defaults to actionResetTypes.zero.

Returns​

Axis2dAction

Properties​

inputGroup​

inputGroup: string

Defined in: input/actions/axis-2d-action.ts:19

The input group this action belongs to.

Implementation of​

InputAction.inputGroup


name​

readonly name: string

Defined in: input/actions/axis-2d-action.ts:11

The name of the action.

Implementation of​

InputAction.name


valueChangeEvent​

readonly valueChangeEvent: ParameterizedForgeEvent<Vector2>

Defined in: input/actions/axis-2d-action.ts:17

Event that is raised whenever the axis value changes. The new value is passed as a parameter to the event listeners.

Accessors​

value​

Get Signature​

get value(): Vector2

Defined in: input/actions/axis-2d-action.ts:53

Gets the current value of the axis as a Vector2, where x and y range from -1 to 1.

Returns​

Vector2

Methods​

reset()​

reset(): void

Defined in: input/actions/axis-2d-action.ts:46

Resets the object to its initial state.

Returns​

void

Implementation of​

Resettable.reset


set()​

set(x, y): void

Defined in: input/actions/axis-2d-action.ts:58

Sets the current value of the axis as a Vector2, where x and y range from -1 to 1.

Parameters​

x​

number

y​

number

Returns​

void