Skip to main content
Version: Next (dev)

Player Look Settings and Look Input

Two things decide how the camera answers the player's hands. The player look settings are the player's own preferences (sensitivity, invert Y, field-of-view offset and framing assist), stored with their input bindings so an options menu can change them. The look input on each view names the input actions that turn it.

Player look settings​

plCameraPlayerSettings reads the settings from the running game application's input bindings every frame, so a change in an options menu applies at once. The values are stored as named values in InputBindings.ddl, in the same settings folder as GameSettings.ddl, next to the player's rebinding overrides. When there is no game application, the defaults below are used.

KeyDefaultDescription
Camera.LookSensitivity1Multiplier on all look input of first- and third-person views. Values below 0 count as 0.
Camera.InvertY0Values above 0.5 invert vertical look input.
Camera.FieldOfViewOffset0Degrees added to every field of view written to the camera, by the director and by standalone views. The result is kept between 1° and 170°.
Camera.MouseAssist0How strongly Composition may turn a first- or third-person camera while the player uses keyboard and mouse (0–1).
Camera.GamepadAssist1The same while the player uses any other input scheme (0–1).

The assist value in effect follows the input scheme the player is using right now, so switching from mouse to gamepad mid-game switches the assist too. Assist only scales Composition's soft-zone correction, and the soft-zone edge always holds. See Framing.

Changing the settings from game code​

CallSets
plCameraPlayerSettings::SetLookSensitivity(float)Camera.LookSensitivity
plCameraPlayerSettings::SetInvertY(bool)Camera.InvertY
plCameraPlayerSettings::SetFieldOfViewOffset(float)Camera.FieldOfViewOffset
plInputBindings::SetValue(key, value)Any key, including the two assist keys.
plInputBindings::Execute("SetValue", { Key, Value })Any key, from game UI or managed code. Execute("Query") returns the stored values under Values.

The input bindings save pending changes to InputBindings.ddl during their per-frame update.

Adding camera options to an options menu​

  1. Add a slider for look sensitivity (for example 0.2 to 3) and a toggle for invert Y.
  2. When the slider changes, call Execute("SetValue", args) on the game application's input bindings, where args holds Key = "Camera.LookSensitivity" and Value = the slider value. For the toggle, set Camera.InvertY to 0 or 1.
  3. Optionally add a field-of-view slider that sets Camera.FieldOfViewOffset, for example from -10 to 20.
  4. For an "aim assist" or "camera assist" option, set Camera.GamepadAssist (and Camera.MouseAssist if mouse players should get it) between 0 and 1.
  5. When the menu opens, read the current values with Execute("Query") to fill the controls.

Look input​

The Third Person and First Person views have a LookInput property of type plCameraLookInput, in their Control group. It names the input actions that turn the view, read through a plInputComponent. The view looks for that component on its subject and the subject's parents first, then on the view's own object and its parents. It must be active.

PropertyDefaultDescription
LookActionemptyA vector action: x turns right, y looks up.
TurnLeftActionemptyTurns left by the action's value.
TurnRightActionemptyTurns right by the action's value.
LookUpActionemptyLooks up by the action's value.
LookDownActionemptyLooks down by the action's value.
Sensitivity1Multiplier for this view (0–100).
InvertYoffInverts vertical input for this view.

The vector action and the four directional actions are all read and added together, so a project can bind a stick to the vector action and keep existing look buttons. With no action set, the view reads no input and is driven by script only.

How values are interpreted​

Action values are treated as per-frame deltas in radians. The amount applied each frame is:

(vector + directional actions) × Sensitivity × Camera.LookSensitivity × zoom look scale

The zoom look scale comes from active Zoom modifiers and is 1 otherwise. The view's InvertY and the player's Camera.InvertY each flip the vertical part, so with both on the input is not inverted.

warning

Mouse movement already arrives as an amount per frame and fits this directly. An action that reports a steady value while held, such as a stick or a key, is applied in full every frame: at value 1 and Sensitivity 1 it turns one radian per frame, and it turns faster at higher frame rates. Give such actions a small scale in the input action map or a low Sensitivity.

Steering​

Any non-zero look input in a frame marks the player as steering that frame. Composition then holds back its soft-zone correction, Look At breaks out (with BreakOnInput), Look Hint restarts its idle timer, and the Third Person View restarts its recenter delay. Panning a Top-Down View also counts as steering.

Troubleshooting​

SymptomLikely cause
Settings changes have no effectThe values were written somewhere other than the game application's input bindings, or the key name is misspelled. Keys are case sensitive.
The camera spins far too fast with a stickStick values are applied per frame. Scale the action down or lower Sensitivity.
Vertical look is inverted unexpectedlyBoth the view's InvertY and Camera.InvertY flip it, so check both.
Field of view in the editor's play mode differs from a buildA stored Camera.FieldOfViewOffset applies wherever the input bindings are loaded.

See also: Gameplay Cameras · Camera Views · Framing, Look At and Focus · The Modifier Stack