Arena FPS Movement System
Kinematic movement framework for Unity designed for classic, fast-paced FPS movement. Built without Unity's built-in CharacterController or physics forces, relying instead on a custom collide-and-slide sweep solver running on a fixed-rate tick loop.
Key Capabilities
- Quake-style movement physics (air strafing, ground acceleration, friction, and speed caps).
- Custom CapsuleCastNonAlloc collision solver with velocity plane clipping.
- Fixed tick rate manager decoupled from rendering frame rate.
- ScriptableObject configuration for all movement and physics parameters.
- Abstract controller base class to decouple input handling from motor logic.
- Built-in mechanics for crouch blending (with overhead clearance checks), sprinting, ladders, step-up/step-down handling, coyote time, jump buffering, and noclip.
Script Architecture
AFPSMotor
The primary movement controller. Runs character state updates (Walking, Sprinting, Crouching) and physics calculations driven by AFPSTickManager.
- Locomotion: Calculates ground friction, ground acceleration, air acceleration, slope limits, and terminal velocity.
- Step Logic: Uses StepAndSlide to step over bumps up to MaxStepHeight, and StepDown to stay grounded when running down stairs or slopes.
- Interactions: Handles ladder climbing based on relative angles, ceiling collision checks prior to standing up, and noclip state.
- Events: Exposes OnJumped, OnLanded, and OnStateChanged events for UI, camera, or audio hooks.
AFPSCollisionSolver
A custom physics solver that handles capsule collision testing and velocity deflection manually.
- Capsule Sweeps: Executes CapsuleSweep and GroundSweep via Physics.CapsuleCastNonAlloc using skin-width buffers to prevent floating-point sticking or wall clipping.
- Plane Clipping: Uses ClipVelocity and a multi-plane loop (CollideAndSlide) to project movement vectors along intersecting geometry normals.
AFPSTickManager
A persistent singleton that controls movement tick timing.
- Uses a delta-time accumulator set to a target frequency (default 125Hz) so movement behaves identically across varying frame rates.
- Clamps max ticks per frame to protect against physics loops during lag spikes.
AFPSSettings
A ScriptableObject containing all configurable parameters:
- Walk, sprint, crouch, air, and climb speeds.
- Acceleration rates, air acceleration caps, friction, and stop speeds.
- Gravity, max slope angle, max step height, terminal velocity, and noclip speed.
- Jump force, coyote time, jump buffer duration, and raycast padding margins.
AFPSControllerBase
An abstract input abstraction layer.
- Stores input vectors (MoveInput, LookRotation) and movement flags (Jump, Crouch, Sprint, Noclip).
- Allows swapping between legacy Input, the New Input System, or AI drive logic without modifying AFPSMotor.
___________________________________________________________________________________________
User Guide
WebDemo