|
group2 0.1.0
CSE 125 Group 2
|
AAA-style controller aim assist — applied after runGamepadLook. More...
#include "InputSampleSystem.hpp"#include "ecs/components/CollisionShape.hpp"#include "ecs/components/Controllable.hpp"#include "ecs/components/InputSnapshot.hpp"#include "ecs/components/LocalPlayer.hpp"#include "ecs/components/PlayerVisState.hpp"#include "ecs/components/Position.hpp"#include "ecs/components/RespawnTimer.hpp"#include "ecs/physics/Raycast.hpp"#include "ecs/physics/WorldData.hpp"#include "ecs/registry/Registry.hpp"#include <SDL3/SDL.h>#include <algorithm>#include <cmath>#include <glm/glm.hpp>#include <glm/trigonometric.hpp>#include <limits>Go to the source code of this file.
Classes | |
| struct | systems::GamepadAimAssistConfig |
| Tunable parameters for gamepad aim assist. More... | |
| struct | systems::GamepadAimAssistState |
| Per-frame state required to compute the rotational pull as a delta between frames. More... | |
Namespaces | |
| namespace | systems |
| Client-only input sampling system — split into two halves so mouse look can run every iterate() (smooth camera at any FPS) while movement keys run once per physics tick group (server-consistent). | |
| namespace | systems::aimassist |
Functions | |
| void | systems::aimassist::dirToYawPitch (const glm::vec3 &dir, float &outYaw, float &outPitch) |
| Convert a world-space direction into yaw/pitch matching the renderer convention used by cachedCamFwd_: fwd = (sin(yaw)·cos(pitch), −sin(pitch), cos(yaw)·cos(pitch)). | |
| float | systems::aimassist::coneFalloff (float angleRad, float innerRad, float outerRad) |
| Linear cone falloff: 1.0 inside innerRad, 0.0 outside outerRad. | |
| glm::vec3 | systems::aimassist::rayOntoAABB (const glm::vec3 &eye, const glm::vec3 &dir, const glm::vec3 &aabbMin, const glm::vec3 &aabbMax, float fallbackDist) |
| Find the world point where the camera ray hits the target's AABB, or — if it misses — the closest point on the AABB to the ray's projection at target distance. | |
| void | systems::runGamepadAimAssist (Registry ®istry, SDL_Gamepad *gamepad, const GamepadAimAssistConfig &cfg, GamepadAimAssistState &state, float lookSens, float dt) |
| Apply gamepad aim assist (slowdown + movement-tracking pull) to the local player's InputSnapshot. | |
AAA-style controller aim assist — applied after runGamepadLook.
Two-stage controller assist that helps the player track, rather than locking onto a body part:
Why this is weaker than head/torso magnet pull:
Activation gate — both effects are gated on the player actually moving a stick (≥5% on either left or right stick by default). Holding still gives full manual control. Standard CoD/Apex/Halo convention.
Server-blind — modifies only the local player's InputSnapshot.yaw/ pitch, so prediction & replication are unaffected.
Mouse-only players see nothing — the system early-outs when no gamepad is connected.