How-To: Gamepad Aim Sensitivity
Goal: offer named gamepad sensitivity presets (Slow ... Insane) that map to real scalar multipliers, with a separate value for aiming down sights.
Prerequisites
You added
UCrimsonInputModifierGamepadSensitivity to your look action and implemented ICrimsonInputSettingsProvider (see How-To: Settings-Driven Modifiers).1. Create the sensitivity data asset
UCrimsonAimSensitivityData is a Const primary data asset holding a TMap<ECrimsonGamepadSensitivity, float>. Create one per project and fill a scalar for each preset you expose.
Verify
The asset lists one row per
ECrimsonGamepadSensitivity preset you added, each with a float multiplier.2. Assign it and pick Normal vs ADS
On the UCrimsonInputModifierGamepadSensitivity, set SensitivityLevelTable to your asset and set TargetingType: Normal reads the player's look preset, ADS reads the targeting preset - so hip-fire and aim can scale differently from one look action or two.
// The modifier resolves the scalar each frame (from ICrimsonInputSettingsProvider):const ECrimsonGamepadSensitivity Preset = (TargetingType == ECrimsonTargetingType::Normal)? Provider->GetGamepadLookSensitivityPreset(): Provider->GetGamepadTargetingSensitivityPreset();const float Scalar = SensitivityLevelTable->SensitivityEnumToFloat(Preset);
Verify
Changing the player's preset in settings changes look speed live; a Normal-typed modifier and an ADS-typed modifier scale independently.
Presets are UI, scalars are data
ECrimsonGamepadSensitivity (defined in CrimsonCommon) is what you show in the options menu - 10 named steps. The float it maps to is authored per project in the data asset, so tuning feel never touches code or the settings UI.See also
- How-To: Settings-Driven Modifiers - the provider that supplies the current preset.
- API Reference -
UCrimsonAimSensitivityData,ECrimsonGamepadSensitivity,ECrimsonTargetingType.