Home › Systems › AFS_UX_Locomotion
System

AFS_UX_Locomotion

Smooth movement and snap or smooth turning as controller abilities, with camera- or controller-relative direction.

What it gives you

  • Thumbstick movement with configurable reference frame
  • Snap turn or smooth turn from one component
  • Per-hand input binding

Requires

AFL_Libraries AFM_Abilities AFM_AutoDestroy AFM_Settings AFM_Spline AFM_State AFM_Teleport

Required by

AFS_UI_Menu AF_Examples

11 assets22 API members

Description

Locomotion is two independent controller abilities, so you can put movement on one hand and turning on the other — the standard VR arrangement — without either knowing about the other.

BPC_ControllerAbility_Movement converts thumbstick input into world movement. Movement Direction decides the reference frame: relative to the camera means the player moves where they look, relative to the controller means they can steer with the hand independently of gaze, which some users find more comfortable.

BPC_ControllerAbility_Turn handles rotation. Setting Rotate Step Duration to zero gives a snap turn; a small non-zero value gives a quick smooth turn. Snap turning is the safer default for comfort.

Setup

  1. Add BPC_ControllerAbility_Movement to one motion controller and BPC_ControllerAbility_Turn to the other.
  2. Assign Mapping Contexts Default for the left and right hand.

Usage

Comfort settings

Expose Rotate Step Degree and Rotate Step Duration as game settings — see Add a setting. Comfort preferences vary enormously between users.

Blocking movement contextually

Call setAbilityRestriction on the pawn with the locomotion tag while a menu is open or an object is held.

The pawn mid-turn, snap-turn indicator on screen
AFS_UX_Locomotion_result.pngThe pawn mid-turn, snap-turn indicator on screen
The pawn mid-turn, snap-turn indicator on screen

Key properties

PropertyWhen to change
Movement DirectionCamera-relative or controller-relative steering
Movement SpeedOverall movement multiplier
Rotate Step DegreeSnap turn increment; 30–45° is typical
Rotate Step DurationZero for snap, small non-zero for quick smooth turn

Extending

Derive from either ability to add acceleration curves, dash movement or vignetting.

Performance notes

Performance

Movement calls Interface_RecenterCapsule each frame it moves, which keeps the capsule under the player. This is intentional and inexpensive.

Example map

Map_Examples_Locomotion demonstrates both abilities with configurable settings.

Troubleshooting

The player drifts away from the capsule. Interface_RecenterCapsule is not being called — it is invoked by movement, so custom movement code must call it too.

API reference

Every blueprint asset in this module. Expand an asset to see its members.

Components

BPC_ControllerAbility_DragMove3 members
extends BPC_ControllerAbility

Hand ability for drag locomotion: hold the drag button and the pawn moves to keep the hand where it was relative to the camera, so you pull yourself through the level. A line shows the pull while the button is held. Add it to a motion controller.

KindNameSignatureDescription
varMovement SpeedSettingsfloatMultiplier applied to movement input.
varMapping Contexts DefaultInputST_MappingContext_SideInput mapping contexts applied for the left and right hand, so movement can be bound to a specific controller.
eventInitiateControllerAbility(Pawn: Pawn, MotionController: Actor, Side: E_Side)Sets up the movement ability once the owning motion controller is ready.
BPC_ControllerAbility_Movement5 members
extends BPC_ControllerAbility

Hand ability turning a thumbstick into smooth locomotion. Movement Direction chooses whether the stick is read against the camera or against the controller, Movement Speed scales the input, and the pawn is recentred under the head before each move. Add it to a motion controller; the pawn has to implement the pawn info contract for the camera to be found.

KindNameSignatureDescription
varMovement DirectionSettingsE_Locomotion_DirectionWhether the thumbstick moves the player relative to where they are looking or relative to where the controller points. Controller-relative allows steering with the hand independently of gaze.
varMovement SpeedSettingsfloatMultiplier applied to movement input.
varMapping Contexts DefaultInputST_MappingContext_SideInput mapping contexts applied for the left and right hand, so movement can be bound to a specific controller.
fngetControlDirection(Vector2D: Vector2D, out MovementVector: Vector)Converts a two-axis input into a world movement direction using the configured movement direction mode.
eventInitiateControllerAbility(Pawn: Pawn, MotionController: Actor, Side: E_Side)Sets up the movement ability once the owning motion controller is ready.
BPC_ControllerAbility_Turn6 members
extends BPC_ControllerAbility

Hand ability giving one motion controller snap turning. Each flick rotates the pawn by Rotate Step Degree over Rotate Step Duration, behind a cooldown so a held stick cannot turn twice, and it goes through the pawn's teleport ability so the fade matches an ordinary teleport. Add it to a motion controller; without the teleport ability on the pawn nothing turns.

KindNameSignatureDescription
varRotate Step DegreeSettingsfloatDegrees turned per snap turn input. Set to a small value for near-continuous turning.
varRotate Step DurationSettingsfloatHow long a turn takes, in seconds. Zero gives an instant snap turn, which is more comfortable for many players.
varMapping Contexts DefaultInputST_MappingContext_SideInput mapping contexts applied for the left and right hand.
varSound TurnSoundSoundBaseSound played on each turn.
eventInitiateControllerAbility(Pawn: Pawn, MotionController: Actor, Side: E_Side)Sets up the turn ability once the owning motion controller is ready.
eventTurn(Side: E_Side)Turns the player one step in the given direction.

Helper

BP_Helper_ControllerAbility_DragMovement1 members
extends BP_Helper_ControllerAbility

Helper actor for drag locomotion: receives the left or right drag input, passes presses and releases to its ability, and carries the line drawn while pulling.

KindNameSignatureDescription
varController AbilityBPC_ControllerAbility_DragMoveDrag move ability this helper reports the drag input to.
BP_Helper_ControllerAbility_Movement1 members
extends BP_Helper_ControllerAbility

Input carrier for the movement ability, spawned alongside it. It holds the thumbstick bindings and forwards them to its ability once the hand side matches, since input actions have to live on an actor rather than on a component. Spawned for you, and of interest only when remapping the movement input.

KindNameSignatureDescription
varController AbilityBPC_ControllerAbility_MovementThe movement ability this helper visualises.
BP_Helper_ControllerAbility_Turn1 members
extends BP_Helper_ControllerAbility

Input carrier for the snap turn ability, spawned alongside it. It holds the turn bindings and calls Turn Left or Turn Right on its ability for the matching hand. Spawned for you; touch it only to remap which action turns which way.

KindNameSignatureDescription
varController AbilityBPC_ControllerAbility_TurnThe turn ability this helper visualises.

Settings

BP_Value_Settings_Boolean_Locomotion_Smooth1 members
extends BP_Value_Settings_Bool

Ready-made toggle for smooth locomotion, activating or blocking the movement ability on both hands. The first comfort setting worth offering, because a player who cannot use it needs teleport instead.

KindNameSignatureDescription
eventValue_setBooleanValue_Boolean(SourceInfo: ST_SourceInfo, Value: bool)Applies the smooth locomotion setting. Once the parent has stored the value, every registered movement ability is blocked or unblocked under the Settings Disabled blocker, so switching the setting off takes continuous movement away without disabling the ability outright and without fighting anything else that happens to be blocking it.
BP_Value_Settings_Boolean_Locomotion_Turn1 members
extends BP_Value_Settings_Bool

Ready-made toggle choosing between snap and smooth turning on the turn ability. Snap is the comfortable default; offer the choice rather than deciding for the player.

KindNameSignatureDescription
eventValue_setBooleanValue_Boolean(SourceInfo: ST_SourceInfo, Value: bool)Applies the turning setting. Once the parent has stored the value, every registered turn ability is blocked or unblocked under the Settings Disabled blocker, so switching it off removes snap and smooth turning while leaving the ability itself alone.
BP_Value_Settings_Float_Locomotion_TurnSpeed1 members
extends BP_Value_Settings_Float

Ready-made slider for how long a turn takes. Zero is an instant snap, which most players find most comfortable; raising it animates the turn instead.

KindNameSignatureDescription
eventValue_setFloatValue_Float(SourceInfo: ST_SourceInfo, Value: float)Implemented by a float value to take a new value from the pawn described by the source info. Sliders call it as their handle moves; the drag state reads the value as 0 to 1 across its own range.
BP_Value_Settings_Integer_Locomotion_Direction1 members
extends BP_Value_Settings_Integer

Ready-made selector for whether the thumbstick moves the player relative to where they are looking or where the controller points. Head-relative is the more intuitive default; experienced players often prefer hand-relative.

KindNameSignatureDescription
eventValue_setIntegerValue_Integer(SourceInfo: ST_SourceInfo, Value: int)Implemented by an integer value to take a new value from the pawn described by the source info. Drop-downs call it when one of their options is chosen.
BP_Value_Settings_Integer_Locomotion_SnapAngle1 members
extends BP_Value_Settings_Integer

Ready-made selector for how far a snap turn rotates. Pair it with the turn-style toggle and disable it while smooth turning is chosen, since it has no meaning there.

KindNameSignatureDescription
eventValue_setIntegerValue_Integer(SourceInfo: ST_SourceInfo, Value: int)Implemented by an integer value to take a new value from the pawn described by the source info. Drop-downs call it when one of their options is chosen.