APawn::AddControllerRollInput
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Adds roll rotation to the owning PlayerController's ControlRotation. Used for vehicles, aircraft, or other pawns that require barrel-roll or banking input.
Caveats & Gotchas
- • Roll is not applied by default to standard humanoid characters (ACharacter ignores controller roll for the capsule). You must explicitly use the controller's roll value in your rotation logic or camera setup.
- • Like pitch and yaw inputs, this only affects local PlayerControllers and is a no-op for AI or remote controllers.
Signature
virtual void AddControllerRollInput(float Val); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Val | float | Amount to add to roll. Multiplied by the PlayerController's InputRollScale before application. | — |
Return Type
void Examples
Apply roll input and sync actor rotation to control rotation each tick
Blueprint
Roll a spaceship pawn C++
void ASpaceshipPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("Roll", this, &ASpaceshipPawn::AddControllerRollInput);
}
void ASpaceshipPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Apply the controller's full rotation including roll
SetActorRotation(GetControlRotation());
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?