AActor::GetInputAxisKeyValue
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns the current float value of a specific input key axis, bypassing axis name mappings and querying the raw key state directly.
Caveats & Gotchas
- • Like GetInputAxisValue, this returns 0.0 if input has not been enabled on this actor via EnableInput(). The key must also be an axis key — passing a digital button key returns 0.0 or 1.0, not a continuous range.
- • Querying by FKey makes your code hardware-specific. Prefer GetInputAxisValue() with named mappings for remappable controls; use this only when you need to read a specific physical axis unconditionally.
Signature
ENGINE_API float GetInputAxisKeyValue(const FKey InputAxisKey) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InputAxisKey | const FKey | The specific hardware key or axis to query (e.g. EKeys::Gamepad_LeftX). | — |
Return Type
float Example
Read raw left-stick X axis from gamepad C++
float StickX = GetInputAxisKeyValue(EKeys::Gamepad_LeftX);
if (FMath::Abs(StickX) > 0.1f) // dead zone
{
AddActorWorldOffset(GetActorRightVector() * StickX * Speed * DeltaTime);
} Tags
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?