<Unreal> Methods For Setting Pawn Movement

Saturday, Dec 6, 2025 | 1 minute read | Updated at Saturday, Dec 6, 2025

Jun Yeop(Johnny) Na

1. FloatingPawnMovement

// in header file,
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Movement", meta = (AllowPrivateAccess = "true"))
class UFloatingPawnMovement* FloatingPawnMovement;


// source: MaxSpeed and Acceleration
FloatingPawnMovement = CreateDefaultSubobject<UFloatingPawnMovement>(TEXT("FloatingPawnMovement"));
FloatingPawnMovement->MaxSpeed = CharacterSpeed;
FloatingPawnMovement->Acceleration = 2000.0f;

2. AddActorWorldOffset

const float Speed = 1200.f; // units/sec
const float Dt = GetWorld()->GetDeltaSeconds();

const FRotator YawRot(0.f, GetControlRotation().Yaw, 0.f);
const FVector Forward = FRotationMatrix(YawRot).GetUnitAxis(EAxis::X);
const FVector Right   = FRotationMatrix(YawRot).GetUnitAxis(EAxis::Y);

const FVector Delta = (Forward * Input.Y + Right * Input.X) * Speed * Dt;

Pawn->AddActorWorldOffset(Delta, true); // sweep=true if you want collision

© 2024 - 2026 Junyeop Na Dev

🌱 Powered by Hugo with theme Dream.