UPlayerInput

Object within PlayerController that processes player input.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/PlayerInput.h

Include

#include "GameFramework/PlayerInput.h"

Syntax

class UPlayerInput : public UObject

Remarks

Object within PlayerController that processes player input. Only exists on the client in network games.

Variables

Name Description

Public variable

TArray< struct ...

 

ActionMappings

This player's version of the Action Mappings

Public variable

TArray< struct ...

 

AxisConfig

This player's version of the Axis Properties

Public variable

TArray< struct ...

 

AxisMappings

This player's version of Axis Mappings

Public variable

TArray< struct ...

 

DebugExecBindings

Generic bindings of keys to Exec()-compatible strings for development purposes only

Public variable

TArray< FName >

 

InvertedAxis

List of Axis Mappings that have been inverted

Public variable

int32

 

MouseSamples

Current average mouse movement/sample

Public variable

float

 

MouseSamplingTotal

Number of mouse samples since mouse movement has been zero

Public variable

float[2]

 

SmoothedMouse

How long received mouse movement has been zero.

Public variable

FVector[EKeys::...

 

Touches

NOTE: These touch vectors are calculated and set directly, they do not go through the .ini Bindings Touch locations, from 0..1 (0,0 is top left, 1,1 is bottom right), the Z component is > 0 if the touch is currently held down

Public variable

TMap< uint32, F...

 

TouchEventLocations

Used to store paired touch locations for event ids during the frame and flushed when processed.

Public variable

float[2]

 

ZeroTime

Mouse smoothing sample data.

Constructors

Name Description

Public function

UPlayerInput()

Functions

Name Description

Public function

void

 

AddActionMapping

(
    const FInputActionKeyMapping& KeyM...
)

Add a player specific action mapping.

Public function

void

 

AddAxisMapping

(
    const FInputAxisKeyMapping& KeyMap...
)

Add a player specific axis mapping.

Public function Static

void

 

AddEngineDefinedActionMapping

(
    const FInputActionKeyMapping& Acti...
)

Add an engine defined action mapping that cannot be remapped.

Public function Static

void

 

AddEngineDefinedAxisMapping

(
    const FInputAxisKeyMapping& AxisMa...
)

Add an engine defined axis mapping that cannot be remapped.

Public function

void

 

ClearSmoothing()

Exec function to reset mouse smoothing values

Protected function

void

 

ConditionalInitAxisProperties()

Initialized axis properties (i.e deadzone values) if needed

Public function

void

 

DiscardPlayerInput()

Rather than processing input, consume it and discard without doing anything useful with it.

Public function Virtual

void

 

DisplayDebug

(
    UCanvas* Canvas,
    const FDebugDisplayInfo& DebugDisp...,
    float& YL,
    float& YPos
)

Draw important PlayerInput variables on canvas.

Public function

bool

 

Exec

(
    UWorld* UInWorld,
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Exec handler

Public function

bool

 

ExecInputCommands

(
    UWorld* InWorld,
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Execute input commands within the legacy key binding system.

Public function

void

 

FlushPressedActionBindingKeys

(
    FName ActionName
)

Flushes the current key state of the keys associated with the action name passed in

Public function

void

 

FlushPressedKeys()

Flushes the current key state.

Public function

void

 

ForceRebuildingKeyMaps

(
    const bool bRestoreDefaults
)

Clear the current cached key maps and rebuild from the source arrays.

Public function

bool

 

GetAxisProperties

(
    const FKey AxisKey,
    FInputAxisProperties& AxisProperti...
)

Gets the axis properties for a given AxisKey.

Public function

FString

 

GetBind

(
    FKey Key
)

Returns the command for a given key in the legacy binding system

Public function Static

const TArray...

 

GetEngineDefinedActionMappings()

Public function Static

const TArray...

 

GetEngineDefinedAxisMappings()

Public function

FKeyBind

 

GetExecBind

(
    FString const& ExecCommand
)

Get the legacy Exec key binding for the given command.

Public function

bool

 

GetInvertAxis

(
    const FName AxisName
)

Returns whether an Axis Mapping is inverted

Public function

bool

 

GetInvertAxisKey

(
    const FKey AxisKey
)

Returns whether an Axis Key is inverted

Public function Const

uint32

 

GetKeyMapBuildIndex()

Public function Const

const TArray...

 

GetKeysForAction

(
    const FName ActionName
)

Returns the list of keys mapped to the specified Action Name

Public function Const

const TArray...

 

GetKeysForAxis

(
    const FName AxisName
)

Returns the list of keys mapped to the specified Axis Name

Public function

FKeyState &#...

 

GetKeyState

(
    FKey InKey
)

Public function Const

float

 

GetKeyValue

(
    FKey InKey
)

Public function

float

 

GetMouseSensitivityX()

Returns the mouse sensitivity along the X-axis, or the Y-axis, or 1.0 if none are known.

Public function

float

 

GetMouseSensitivityY()

Returns the mouse sensitivity along the Y-axis, or 1.0 if none are known.

Public function Const

FVector

 

GetProcessedVectorKeyValue

(
    FKey InKey
)

Public function Const

float

 

GetRawKeyValue

(
    FKey InKey
)

Public function Const

FVector

 

GetRawVectorKeyValue

(
    FKey InKey
)

Public function Const

float

 

GetTimeDown

(
    FKey InKey
)

Public function Virtual Const

UWorld *

 

GetWorld()

Public function

bool

 

InputAxis

(
    FKey Key,
    float Delta,
    float DeltaTime,
    int32 NumSamples,
    bool bGamepad
)

Handles an axis input event. Returns true if a legacy key bind handled the input, otherwise false.

Public function

bool

 

InputGesture

(
    const FKey Gesture,
    const EInputEvent Event,
    const float Value
)

Handles a gesture input event. Returns true.

Public function Virtual

bool

 

InputKey

(
    FKey Key,
    enum EInputEvent Event,
    float AmountDepressed,
    bool bGamepad
)

Handles a key input event. Returns true if there is an action that handles the specified key.

Public function

bool

 

InputMotion

(
    const FVector& Tilt,
    const FVector& RotationRate,
    const FVector& Gravity,
    const FVector& Acceleration
)

Handles a motion input event. Returns true.

Public function

bool

 

InputTouch

(
    uint32 Handle,
    ETouchType::Type Type,
    const FVector2D& TouchLocation,
    float Force,
    FDateTime DeviceTimestamp,
    uint32 TouchpadIndex
)

Handles a touch input event. Returns true.

Public function

void

 

InvertAxis

(
    const FName AxisName
)

Exec function to invert an axis mapping

Public function

void

 

InvertAxisKey

(
    const FKey AxisKey
)

Exec function to invert an axis key

Public function Const

bool

 

IsAltPressed()

Public function Const

bool

 

IsCmdPressed()

Public function Const

bool

 

IsCtrlPressed()

Public function Const

bool

 

IsPressed

(
    FKey InKey
)

Public function Const

bool

 

IsShiftPressed()

Public function

void

 

ProcessInputStack

(
    const TArray< UInputComponent*...,
    const float DeltaTime,
    const bool bGamePaused
)

Process the frame's input events given the current input component stack.

Public function

void

 

RemoveActionMapping

(
    const FInputActionKeyMapping& KeyM...
)

Remove a player specific action mapping.

Public function

void

 

RemoveAxisMapping

(
    const FInputAxisKeyMapping& KeyMap...
)

Remove a player specific axis mapping.

Public function

void

 

SetAxisProperties

(
    const FKey AxisKey,
    const FInputAxisProperties& AxisPr...
)

Gets the axis properties for a given AxisKey.

Public function

void

 

SetBind

(
    FName BindName,
    const FString& Command
)

Exec function to add a debug exec command

Public function

void

 

SetMouseSensitivity

(
    const float Sensitivity
)

Sets both X and Y axis sensitivity to the supplied value.

Public function

void

 

SetMouseSensitivity

(
    const float SensitivityX,
    const float SensitivityY
)

Exec function to change the mouse sensitivity

Public function Virtual

float

 

SmoothMouse

(
    float aMouse,
    uint8& SampleCount,
    int32 Index
)

Smooth mouse movement, because mouse sampling doesn't match up with tick time.

Public function

void

 

Tick

(
    float DeltaTime
)

Per frame tick function. Primarily for gesture recognition

Public function

void

 

UpdatePinchStartDistance()

Manually update the GestureRecognizer AnchorDistance using the current locations of the touches

Public function Const

bool

 

WasJustPressed

(
    FKey InKey
)

Public function Const

bool

 

WasJustReleased

(
    FKey InKey
)

Return true if InKey went from down to up since player input was last processed.

Overridden from UObject

Name Description

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Constants

Name

Description

EngineDefinedActionMappings

Action Mappings defined by engine systems that cannot be remapped by users

EngineDefinedAxisMappings

Axis Mappings defined by engine systems that cannot be remapped by users

NoAxisMappings

Static empty array to be able to return from GetKeysFromAxis when there are no axis mapped to the requested axis name

NoKeyMappings

Static empty array to be able to return from GetKeysFromAction when there are no keys mapped to the requested action name

Deprecated Functions

Name Description

Public function

float

 

GetMouseSensitivity()

Call axis specific GetMouseSensitivityX or GetMouseSensitivityY instead.

Public function Const

FVector

 

GetVectorKeyValue

(
    FKey InKey
)

Use GetProcessedVectorKeyValue or GetRawVectorKeyValue instead. GetRawVectorKeyValue will have the same result as GetVectorKeyValue previously.

Public function

bool

 

InputTouch

(
    uint32 Handle,
    ETouchType::Type Type,
    const FVector2D& TouchLocation,
    FDateTime DeviceTimestamp,
    uint32 TouchpadIndex
)

InputTouch now takes a Force

See Also

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback