Skip to content

Game.Input.CameraRotateProcessor

Assembly: Assembly-CSharp
Namespace: Game.Input

Type: class

Base: PlatformProcessor

Summary:
A processor for rotation input that applies per-axis scaling and device-specific sensitivity/inversion settings. It reads input tuning from SharedSettings.instance.input (InputSettings) and modifies the incoming Vector2 (usually representing rotate X/Y) according to m_ScaleX/m_ScaleY and the current input device type (m_DeviceType). Processing is skipped when the base needProcess flag is false.


Fields

  • public float m_ScaleX = 1f
    Applies an additional multiplier to the X (horizontal) component before device-specific sensitivity/inversion is applied. Default is 1 (no extra scaling).

  • public float m_ScaleY = 1f
    Applies an additional multiplier to the Y (vertical) component before device-specific sensitivity/inversion is applied. Default is 1 (no extra scaling).

Additional implementation notes: This class reads settings from SharedSettings.instance.input (an InputSettings instance) and relies on inherited members from PlatformProcessor, notably: - needProcess (if false, Process returns the input unchanged) - m_DeviceType (used to select mouse/keyboard/gamepad behavior)

Properties

  • This class does not declare public properties. It relies on inherited functionality from PlatformProcessor.

Constructors

  • public CameraRotateProcessor()
    Default constructor — no special initialization in this class (uses default field values). Behavior and lifecycle are typically managed by the input system infrastructure that creates and configures processors.

Methods

  • public override Vector2 Process(Vector2 value, InputControl control)
    Processes and returns a modified Vector2 according to:
  • Early exit: if base.needProcess is false, returns the incoming value unchanged.
  • Applies m_ScaleX to value.x and m_ScaleY to value.y.
  • Multiplies each axis by device- and setting-specific sensitivity and inversion:
    • Mouse X/Y: uses input.mouseRotateSensitivity and optionally negates based on mouseInvertX / mouseInvertY.
    • Keyboard: uses input.keyboardRotateSensitivity.
    • Gamepad X: uses input.gamepadRotateSensitivity and optionally negates based on gamepadInvertX.
    • Gamepad Y: the code currently applies only inversion (-1/1) for Y but does not multiply by gamepadRotateSensitivity — this looks inconsistent and likely a bug (should probably multiply by gamepadRotateSensitivity and respect gamepadInvertY similarly to other branches).
  • The InputControl parameter is accepted (UnityEngine.InputSystem) but is not used by this implementation.

Behavioral caveats: - The implementation uses a switch on m_DeviceType to select sensitivity/inversion. Ensure m_DeviceType is set correctly by the surrounding input platform logic. - The gamepad Y branch omits scaling by sensitivity; modders may want to correct this if unexpected behavior occurs. - Because the method mutates and returns the input Vector2, consumers should be aware that returned value is the processed one.

Usage Example

// Example usage in a custom input handler or unit test
var processor = new Game.Input.CameraRotateProcessor
{
    m_ScaleX = 1.2f,
    m_ScaleY = 0.9f
};

// Simulated raw rotate input (e.g., mouse delta or virtual stick)
Vector2 raw = new Vector2(0.5f, -0.25f);

// InputControl is not used by this processor, so we can pass null in tests.
// In production this would be provided by the Input System callback.
Vector2 processed = processor.Process(raw, control: null);

// processed now has scale + device-specific sensitivity/inversion applied.

Notes for modders: - To change runtime behavior, adjust m_ScaleX / m_ScaleY or modify SharedSettings.instance.input values (mouseRotateSensitivity, keyboardRotateSensitivity, gamepadRotateSensitivity, and the invert flags). - If you observe asymmetric behavior on gamepads (Y axis ignoring sensitivity), inspect/patch the Process method to include gamepadRotateSensitivity for the Y branch.