RealDocs

AActor::GetInputAxisValue

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

Description

Returns the current float value of a named input axis, provided this actor has input enabled. Useful for polling axis state outside of a bound axis delegate.

Caveats & Gotchas

  • • Returns 0.0 if input has not been enabled on this actor via EnableInput(). You must call EnableInput(PlayerController) before this will return meaningful values.
  • • This function only works with the legacy Input system axis mappings. It is not compatible with the Enhanced Input plugin — use UEnhancedInputComponent or query UEnhancedInputLocalPlayerSubsystem instead.
  • • The UFUNCTION metadata marks it as BlueprintInternalUseOnly, meaning Blueprint users should use the generated 'Get [AxisName] Axis' nodes rather than calling this directly.

Signature

ENGINE_API float GetInputAxisValue(const FName InputAxisName) const;

Parameters

Name Type Description Default
InputAxisName const FName The name of the input axis mapping as defined in the Input settings. —

Return Type

float

Example

Poll move axis value in Tick C++
void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    float MoveForward = GetInputAxisValue(FName("MoveForward"));
    AddActorWorldOffset(GetActorForwardVector() * MoveForward * Speed * DeltaTime);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable —

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.