Ship Interior Control System Guide
March 7, 2026 · View on GitHub
Overview
The Ship Interior Control System allows players to control their spaceship from inside the interior by interacting with a control console. The system handles possession swapping between the player's walking pawn and the ship pawn seamlessly.
Components
1. AShipControlConsole
An interactable actor placed inside the spaceship interior that serves as the pilot's control interface.
Key Properties:
OwningShip- Reference to the spaceship being controlledInteractionRange- Distance from console where player can interact (default: 150 units)bIsControlActive- Whether the console is currently in use
Key Methods:
Interact(PlayerController)- Toggles ship control on/offCanInteract(PlayerController)- Checks if interaction is possible
2. ASpaceship Control Methods
The spaceship class now supports direct player control with possession swapping.
New Methods:
-
BeginControl(PC, ExternalPawn)- Start controlling the ship- Saves the walking pawn reference
- Disables and hides the walking pawn
- Possesses the ship
- Activates ship movement
-
EndControl(PC)- Stop controlling the ship- Returns possession to walking pawn
- Restores walking pawn visibility and collision
- Teleports player to exit location
- Clears saved pawn reference
-
SetupPlayerInputComponent(InputComponent)- Binds ship controls- MoveForward/Back (W/S)
- MoveRight/Left (A/D)
- MoveUp/Down (Space/Ctrl)
- Turn (Mouse X)
- LookUp (Mouse Y)
New Properties:
TurnRate- Rotation speed in degrees per second (default: 45.0)SavedExternalPawn- Stored reference to walking pawn
3. ASpaceshipInterior Exit Location
The interior now tracks where the player should be placed when exiting ship control.
New Methods:
GetExitLocation()- Returns the exit spawn point
New Properties:
ExitLocation- World location for player exit
Setup Instructions
Step 1: Configure Input (Already Done)
Input mappings are configured in Config/DefaultInput.ini:
- Axis: MoveForward, MoveRight, MoveUp, Turn, LookUp
- Action: Interact
Step 2: Place Control Console in Interior Blueprint
- Open your spaceship's interior Blueprint
- Add a
ShipControlConsoleactor to the scene - Position it where the pilot seat/console should be
- In the Details panel, set:
OwningShip: Reference to the parent spaceshipInteractionRange: Adjust as needed (e.g., 150-200 units)
Step 3: Configure Exit Location
- In the interior Blueprint or actor instance:
- Set the
ExitLocationproperty - This is where the player will spawn when leaving the pilot seat
- Typically near the console or at a seat location
Step 4: Implement Player Interact Logic
In your player character/pawn Blueprint or C++ class:
- Bind the "Interact" action input
- On interact press, perform a sphere/line trace
- Check if hit actor is a
ShipControlConsole - Call
Console->Interact(GetController())
Example Blueprint Logic:
On "Interact" Pressed:
└─> Line Trace (or Sphere Overlap)
└─> Hit Actor is ShipControlConsole?
└─> Cast to ShipControlConsole
└─> Call Interact (PlayerController)
Example C++ Code:
void APlayerCharacter::OnInteract()
{
// Trace for interactable objects
FHitResult HitResult;
FVector Start = GetActorLocation();
FVector End = Start + GetActorForwardVector() * 200.0f;
if (GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Visibility))
{
AShipControlConsole* Console = Cast<AShipControlConsole>(HitResult.GetActor());
if (Console && Console->CanInteract(GetController<APlayerController>()))
{
Console->Interact(GetController<APlayerController>());
}
}
}
Usage Flow
Entering Ship Control
- Player walks to the control console inside the interior
- Player presses Interact (E key by default)
- System checks if console can be interacted with
- Walking pawn is saved, hidden, and disabled
- Player controller possesses the spaceship
- Player can now control the ship with WASD/Mouse
Exiting Ship Control
- Player presses Interact (E key) again while controlling ship
- Player controller re-possesses the walking pawn
- Walking pawn is restored (visible, collision enabled)
- Walking pawn is teleported to the exit location
- Player can now walk around the interior again
Customization
Adjusting Turn Rate
Change the TurnRate property on the spaceship Blueprint to adjust rotation sensitivity:
- Lower values = slower turning (e.g., 30.0 for heavy ships)
- Higher values = faster turning (e.g., 60.0 for fighters)
Custom Exit Behavior
Override or extend ASpaceship::EndControl() to:
- Add camera transitions
- Play sound effects
- Show/hide UI elements
- Trigger animations
Multiple Control Stations
You can place multiple ShipControlConsole actors in the interior:
- All reference the same
OwningShip - Each can have different interaction ranges
- Only one can be active at a time (handled automatically)
Blueprint Integration
All functionality is exposed to Blueprints:
ShipControlConsole->Interact()- BlueprintCallableSpaceship->BeginControl()- BlueprintCallableSpaceship->EndControl()- BlueprintCallable- All properties are BlueprintReadWrite or BlueprintReadOnly
Troubleshooting
Console doesn't respond to interact
- Check that
OwningShipreference is set - Verify player is within
InteractionRange - Ensure player's interact logic calls the console's
Interact()method
Player stuck controlling ship
- Call
Console->Interact()again to toggle off - Or manually call
Ship->EndControl(PlayerController)
Walking pawn disappears after exit
- Check that
SavedExternalPawnis not null - Verify
EndControl()is being called properly - Check that the walking pawn still exists in the world
Ship doesn't move when controlled
- Verify input bindings in DefaultInput.ini
- Check that
MovementComponentis active - Ensure
SetupPlayerInputComponent()is being called
Example: Complete Setup
- Create a Blueprint based on
ASpaceship(e.g.,BP_PlayerShip) - Add interior mesh and collision
- Place a
ShipControlConsoleactor at the pilot station - Set console's
OwningShipto self (the ship Blueprint) - Configure
ExitLocationin the interior instance - Implement player interact to detect and call console interaction
- Test in-game: walk to console, press E to control, press E again to exit
Notes
- The system preserves the walking pawn's state during control
- Input is automatically routed to the possessed pawn (ship or walker)
- Movement component remains active throughout possession swaps
- Console interaction is proximity-based for realistic gameplay
- Exit location can be set per-interior or per-console for flexibility
Future Enhancements
Possible additions to this system:
- Smooth camera transitions
- UI prompts for interact availability
- Sound effects for entering/exiting control
- Animation support for sitting/standing
- Co-pilot seats with limited controls
- Damage effects on console disabling control