The HotWheels SDK aimbot system provides intelligent target selection and hitchance calculation for weapon accuracy prediction.
Overview
The aimbot module (hacks/features/aimbot/) implements automatic aiming with advanced features:
- Target selection based on field-of-view (FOV)
- Hitchance calculation using weapon spread simulation
- Recoil compensation
- Lag compensation integration
Target Selection
The aimbot finds the closest valid target using FOV-based prioritization:
sdk::c_cs_player* aimbot::impl::find_closest( )
{
float closest_fov = 180.f;
sdk::c_cs_player* closest_player = nullptr;
for ( auto& player_info : g_entity_list.players ) {
auto player = g_interfaces.entity_list->get_client_entity< sdk::c_cs_player* >( player_info.m_index );
if ( !player_info.m_valid || !player )
continue;
if ( auto player_fov = math::get_fov( g_ctx.cmd->view_angles, g_ctx.local->eye_position( ), player->eye_position( ) );
player_fov < closest_fov ) {
closest_fov = player_fov;
closest_player = player;
}
}
return closest_player;
}
Source: hacks/features/aimbot/aimbot.cpp:16-35
The target selection algorithm prioritizes players closest to your crosshair based on angular distance (FOV), not physical distance.
Hitchance Calculation
The hitchance system simulates weapon spread to predict shot accuracy:
Get Weapon Data
Retrieve weapon inaccuracy and spread values from the current weapon
Simulate 256 Shots
Calculate spread vectors for 256 iterations to simulate weapon randomness
Ray Tracing
Check if each simulated shot would hit the target hitbox
Calculate Percentage
Return the percentage of successful hits as hitchance
Implementation
float aimbot::impl::hitchance( sdk::c_cs_player* player, math::vec3 angles, sdk::hitgroup hit_group )
{
math::vec3 start = g_ctx.local->eye_position( ), end{ }, forward{ }, right{ }, up{ }, direction{ }, weapon_spread{ };
float innaccuracy = g_ctx.weapon->inaccuracy( ), spread = g_ctx.weapon->spread( );
int total_hits{ };
math::angle_vectors( angles, &forward, &right, &up );
auto weapon_data = g_ctx.weapon->get_weapon_data( );
for ( int iterator = 0; iterator < 256; iterator++ ) {
weapon_spread = g_ctx.weapon->spread_vector( iterator, innaccuracy, spread );
direction = ( forward + ( right * weapon_spread.x ) + ( up * weapon_spread.y ) ).normalized( );
end = start + ( direction * weapon_data->range );
if ( g_ctx.local->can_see_player_ignore_walls( player, hit_group, start, end ) )
total_hits++;
}
return ( total_hits / 255.f ) * 100.f;
}
Source: hacks/features/aimbot/aimbot.cpp:37-59
The hitchance calculation uses 256 iterations for accuracy. Higher iteration counts will impact performance.
Main Execution Loop
The aimbot runs on every frame when conditions are met:
void aimbot::impl::run( )
{
if ( !g_ctx.cmd->buttons.has( sdk::buttons::IN_ATTACK ) )
return;
if ( !g_ctx.local || !g_ctx.weapon )
return;
auto entity = find_closest( );
if ( !entity )
return;
if ( !g_ctx.local->can_see_player( entity ) )
return;
g_lagcomp.backtrack_player( entity );
math::vec3 forward_to_head = g_ctx.local->eye_position( ) - entity->hitbox_position( sdk::HITGROUP_HEAD );
math::vec3 angles_to_head;
math::vector_angles( forward_to_head, angles_to_head );
float head_hitchance = hitchance( entity, angles_to_head, sdk::HITGROUP_HEAD );
}
Source: hacks/features/aimbot/aimbot.cpp:61-110
Recoil Compensation
The aimbot automatically compensates for weapon recoil:
static auto recoil_scale = g_convars[ _("weapon_recoil_scale") ];
auto recoil_angle = g_ctx.local->aim_punch_angle( ) * ( recoil_scale->get_float( ) * -1.f );
angles_to_head += recoil_angle;
angles_to_head = angles_to_head.normalize( );
Source: hacks/features/aimbot/aimbot.cpp:91-96
Integration Points
Lag Compensation
The aimbot integrates with the lag compensation system to backtrack player positions:
g_lagcomp.backtrack_player( entity );
if ( g_ctx.record ) {
forward_to_head = g_ctx.local->eye_position( ) - entity->hitbox_position( sdk::HITGROUP_HEAD, g_ctx.record->bone_matrix );
math::vector_angles( forward_to_head, angles_to_head );
}
Visibility Checks
Before aiming, the system verifies line-of-sight:
if ( !g_ctx.local->can_see_player( entity ) )
return;
API Reference
find_closest()
Finds the closest valid target based on FOV.
Returns: sdk::c_cs_player* - Pointer to closest player or nullptr
hitchance(player, angles, hit_group)
Calculates shot accuracy percentage.
Parameters:
player - Target player entity
angles - Aim angles to test
hit_group - Target hitbox group (e.g., HITGROUP_HEAD)
Returns: float - Hitchance percentage (0-100)
run()
Main aimbot execution function. Called every tick.
The aimbot only activates when the attack button is pressed (IN_ATTACK flag).