Crosshair

//: FILE SYSTEM MAINTENANCEThis article is still under construction, and may not comply with our formatting standards.
Our data analysts are actively working on it to ensure optimal file system maintenance in accordance with the Style Codex.
The **Crosshair** in Azpect FPS is a vital Heads-Up Display (HUD) element situated at the centre of the screen. It serves multiple functions; aiding players in aiming, understanding weapon accuracy, and gauging effective shot range. The Crosshair changes shape to reflect the type of weapon being used and its firing mode, and the "hairs" themselves expand and contract to reflect the accuracy of the next shot. Players can adjust both the Crosshairs' and Hitmarkers' colours and sizes.

## //: Details

The key functions and features of the Crosshair include:

* **Aiming Assistance**: The primary role of the Crosshair is to facilitate accurate aiming. Positioned at the centre of the screen, it provides a visual reference point for players to align their shots. Whether engaging an enemy, observing an objective, or assessing your surroundings, the Crosshair offers agents a consistent point of reference.
* **Weapon and Firing Mode Indication**: The Crosshair adapts to the type of weapon the player is using and its firing mode. This visual feature helps agents quickly identify the weapon they have equipped and its current mode of operation. For instance, a Sniper Rifle is typically semi-automatic only, so the Crosshair reflects this by truncating the top-most hair, a shape differing significantly from that of an Assault Rifle.
* **Accuracy Gauge**: The "hairs" or lines within the crosshair expand and contract to convey the accuracy of the player's next shot. A smaller and tighter crosshair indicates higher accuracy, while a larger crosshair suggests reduced accuracy. Any shot is guaranteed to land within the Crosshair's "cone" no matter how small or large it may be, therefore as long as the target is enveloped within the range of the Crosshair, the target will receive the shot. Understanding these size changes is crucial for making informed decisions during firefights.

The size of the Crosshair's cone, and consequently the hip-firing accuracy of your weapon, is subject to various influencing factors. Of course, with sustained firing, the cone size will progressively expand. Each weapon has its unique increase in cone size per shot, along with predefined minimum and maximum cone size values. When performing actions such as moving forward or backward or strafing left and right, there is a slight reduction in accuracy. Jumping and executing vault manoeuvres have a more substantial detrimental impact on accuracy. However, changing your stance can have a positive effect on accuracy, with crouching providing a modest improvement and proning offering a significant boost.

Additionally, an agent's current Stamina level plays a crucial role in determining accuracy. When a player's Stamina is at 25% or lower, the accuracy penalties mentioned above become more pronounced. This penalty starts with a multiplier of 1.01x at 25% Stamina and increases by 0.01x for every Stamina point less, culminating at a 1.25x multiplier when Stamina is depleted. Managing Stamina levels is essential to maintaining optimal accuracy during combat situations in Azpect FPS.

Sprinting or positioning the player character against a wall, causing the weapon to press against it, prevents the player from firing. In this scenario, the crosshair transforms into a single dot on the screen, signalling that firing is currently unavailable.

### //: Hitmarkers

Hitmarkers are a subset of HUD graphics that work in tandem with the Crosshair. They share the same central screen position as the Crosshair and serve as a visual indicator of where a player's shots have landed and the type of damage that was inflicted. Hitmarkers change colour and shape to reflect different types of damage. From lowest to highest hierarchy, the types of Hitmarkers in Azpect FPS are represented with these default colours:

* A **cyan** hitmarker indicates the shot struck an armored target, resulting in the round being deflected and reducing their AP.
* A **white** hitmarker indicates the shot has either hit an unarmored target, causing a deduction in their HP, or shattered the target's shield, reducing their AP to 0, and subsequently deducting HP.
* A **light red** "double-hitmarker" signifies the shot has hit the target's head or fractured a region of the target's body.
* A **crimson** hitmarker confirms a fatal shot against the target.

When a shot connects with a target, a Hitmarker is generated through a specific animation process. This process includes selecting the appropriate Hitmarker decal, adjusting the size and opacity, introducing a slight angle, and creating a visual fade-out effect. The duration and visibility of the Hitmarker's animation vary depending on the type of hit (e.g., normal hit or fatal hit). Hitmarkers help players keep track of successive eliminations. In cases where multiple hits are registered in quick succession, the last hitmarker takes precedence, effectively overriding any previous Hitmarkers. This function ensures that players can accurately track the number of consecutive terminations in high-stress combat scenarios.

The animation process is summarized as follows:

1. The selected hitmarker decal corresponds to the type of shot inflicted.
2. The size of the hitmarker layer is temporarily increased to 125% for emphasis.
3. Hitmarkers may rotate at a random angle (-25 degrees to 25 degrees), adding a layer of realism to the experience.
4. The opacity of the hitmarker layer is initially set to 100%.
5. Over a specified duration, the hitmarker layer's scale and angle are gradually reset to 100% and 0 degrees, using keyframes.
6. Hitmarkers remain visible for a brief yet informative duration, usually 10 frames, before gradually fading out over 5 frames.