FlightCameraControlType

FlightCameraControlType

#Overview

name: FlightCameraControlType

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of FlightCameraControlType is to configure the behavior of flight camera controls in the Unreal Engine editor’s viewport. It determines when and how the WASD keys are used for camera movement in the editor.

This setting variable is primarily used by the editor’s viewport system, specifically within the UnrealEd module. It is referenced in the LevelEditorViewportSettings class and utilized in the EditorViewportClient.

The value of this variable is set in the editor’s settings, likely through the Project Settings or Editor Preferences interface. It is defined as a TEnumAsByte, suggesting it has predefined options for different control schemes.

FlightCameraControlType interacts with other variables such as FlightCameraControlExperimentalNavigation, which enables experimental navigation features for the flight camera controls.

Developers should be aware that this variable affects the behavior of the WASD keys in the editor viewport. It can be set to different modes, such as WASD_Always (always active) or WASD_RMBOnly (active only when right mouse button is pressed).

Best practices when using this variable include:

  1. Considering the team’s preferred workflow and setting it accordingly.
  2. Documenting the chosen setting for consistency across the development team.
  3. Being aware of how it interacts with other camera control settings, such as the experimental navigation option.
  4. Testing different settings to find the most comfortable and efficient option for the team’s workflow.
  5. Remembering that this setting affects editor usability rather than in-game behavior, so it should be adjusted based on the team’s editing preferences.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:319, section: [/Script/UnrealEd.LevelEditorViewportSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:275

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** Enable the use of flight camera controls under various circumstances. */
	UPROPERTY(EditAnywhere, config, Category=Controls)
	TEnumAsByte<EWASDType> FlightCameraControlType;

	/** Enable the use of the experimental navigation in the flight camera controls. */
	UPROPERTY(EditAnywhere, config, Category=Controls)
	bool FlightCameraControlExperimentalNavigation;

	/** Choose the control scheme for landscape tools (ignored for pen input) */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:1812

Scope (from outer to inner):

file
function     void FEditorViewportClient::UpdateCameraMovement

Source code excerpt:

		const bool bRemapWASDKeys =
			(bUnmodifiedPress || (GetDefault<ULevelEditorViewportSettings>()->FlightCameraControlExperimentalNavigation && IsShiftPressed())) &&
			(GetDefault<ULevelEditorViewportSettings>()->FlightCameraControlType == WASD_Always ||
			( bUsingFlightInput &&
			( GetDefault<ULevelEditorViewportSettings>()->FlightCameraControlType == WASD_RMBOnly && (Viewport->KeyState(EKeys::RightMouseButton ) ||Viewport->KeyState(EKeys::MiddleMouseButton) || Viewport->KeyState(EKeys::LeftMouseButton) || bIsUsingTrackpad ) ) ) ) &&
			!MouseDeltaTracker->UsingDragTool();

		// Apply impulse from magnify gesture and reset impulses if we're using WASD keys
		CameraUserImpulseData->MoveForwardBackwardImpulse = GestureMoveForwardBackwardImpulse;
		CameraUserImpulseData->MoveRightLeftImpulse = 0.0f;
		CameraUserImpulseData->MoveUpDownImpulse = 0.0f;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:2690

Scope (from outer to inner):

file
function     bool FEditorViewportClient::IsFlightCameraActive

Source code excerpt:


	// Movement key pressed and automatic movement enabled
	bIsFlightMovementKey &= (GetDefault<ULevelEditorViewportSettings>()->FlightCameraControlType == WASD_Always) | bIsUsingTrackpad;

	// Not using automatic movement but the flight camera is active
	bIsFlightMovementKey |= IsFlightCameraInputModeActive() && (GetDefault<ULevelEditorViewportSettings>()->FlightCameraControlType == WASD_RMBOnly );

	return
		!(Viewport->KeyState( EKeys::LeftControl ) || Viewport->KeyState( EKeys::RightControl ) ) &&
		!(Viewport->KeyState( EKeys::LeftShift ) || Viewport->KeyState( EKeys::RightShift ) ) &&
		!(Viewport->KeyState( EKeys::LeftAlt ) || Viewport->KeyState( EKeys::RightAlt ) ) &&
		bIsFlightMovementKey;