Skip to content

Game.Input.CameraMoveProcessor

Assembly: Assembly-CSharp.dll
Namespace: Game.Input

Type: class

Base: PlatformProcessor

Summary: CameraMoveProcessor is an input processor that scales a 2D input (typically camera movement) by configurable X/Y scale factors and by the per-device sensitivity settings from the game's shared InputSettings. It only alters the input when the base PlatformProcessor indicates processing is required (base.needProcess). The final output is the raw input multiplied by m_ScaleX/m_ScaleY and by the device-specific sensitivity (mouse, keyboard, or gamepad) retrieved from SharedSettings.instance.input.


Fields

  • public float m_ScaleX = 1f Used to scale the X component of the incoming Vector2 before applying device sensitivity. Default value is 1. Change this to increase/decrease horizontal movement responsiveness.

  • public float m_ScaleY = 1f Used to scale the Y component of the incoming Vector2 before applying device sensitivity. Default value is 1. Change this to increase/decrease vertical movement responsiveness.

Properties

  • None declared on this class (inherits any properties from PlatformProcessor such as the device type indicator).

Constructors

  • public CameraMoveProcessor() The class relies on the implicit default constructor (no custom initialization logic present). Fields m_ScaleX and m_ScaleY default to 1f.

Methods

  • public override UnityEngine.Vector2 Process(UnityEngine.Vector2 value, UnityEngine.InputSystem.InputControl control) Processes the incoming Vector2 input as follows:
  • If base.needProcess is false, returns the input unchanged.
  • Multiplies value.x by m_ScaleX and value.y by m_ScaleY.
  • Multiplies the scaled vector by a device-specific sensitivity value pulled from SharedSettings.instance.input:
    • ProcessorDeviceType.Mouse => input.mouseMoveSensitivity
    • ProcessorDeviceType.Keyboard => input.keyboardMoveSensitivity
    • ProcessorDeviceType.Gamepad => input.gamepadMoveSensitivity
    • default => 1f
  • Returns the final adjusted Vector2.

Notes: - The processor depends on the m_DeviceType provided by the PlatformProcessor base class to select the appropriate sensitivity. - SharedSettings.instance.input must be available and have the expected sensitivity fields (mouseMoveSensitivity, keyboardMoveSensitivity, gamepadMoveSensitivity).

Usage Example

// Example usage: scale horizontal movement by 0.5, vertical by 0.8,
// then apply device-specific sensitivity from SharedSettings.
var processor = new Game.Input.CameraMoveProcessor
{
    m_ScaleX = 0.5f,
    m_ScaleY = 0.8f
};

// `rawInput` would typically come from an input action; control is not used by this processor.
UnityEngine.Vector2 rawInput = new UnityEngine.Vector2(10f, -5f);
// The PlatformProcessor base normally sets m_DeviceType; if used standalone you must ensure it's set.
// For illustration assume m_DeviceType is already set appropriately by the input system.
UnityEngine.Vector2 adjusted = processor.Process(rawInput, inputControl);

{{ Additional information: This processor is intended to be used within the game's input pipeline (Unity Input System). When integrating into mod code, ensure SharedSettings.instance is accessible and properly initialized. If you need device-dependent calibration beyond global sensitivities, adjust m_ScaleX/m_ScaleY or extend the processor to include per-device axis scales. }}