RealDocs

AActor::GetInputVectorAxisValue

function Engine Blueprint Since 4.7
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallable

Description

Returns the current value of a vector-type input axis key as an FVector. Designed for 2D analog inputs such as a thumbstick, where X and Y components represent the two axes.

Caveats & Gotchas

  • Only meaningful for keys explicitly defined as vector axes in the engine's key definitions. Passing a scalar axis key returns a vector with only the X component populated and Y/Z as zero.
  • Input must be enabled on this actor via EnableInput() or the result is always FVector::ZeroVector. This is not compatible with Enhanced Input.

Signature

ENGINE_API FVector GetInputVectorAxisValue(const FKey InputAxisKey) const;

Parameters

Name Type Description Default
InputAxisKey const FKey The vector axis key to query (e.g. EKeys::Gamepad_LeftStick_2D for a combined 2D stick axis).

Return Type

FVector

Example

Read 2D thumbstick as a vector C++
FVector StickValue = GetInputVectorAxisValue(EKeys::Gamepad_LeftStick_2D);
FVector2D Stick2D(StickValue.X, StickValue.Y);
if (Stick2D.SizeSquared() > DeadZone * DeadZone)
{
    MoveCharacter(Stick2D);
}

Version History

Introduced in: 4.7

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.