DevMesa / ThePringle

De Cheato
6 stars 1 forks source link

Decouple view-position and shoot-position in the aimbot #46

Open AshleighAdams opened 6 years ago

AshleighAdams commented 6 years ago

Currently, view-position and shoot-position are coupled together and calculated by Unit_GetHeadPosition, which is correct for neither. The shoot-position should be where the bullets/projectiles originate, and the view position is where the camera you see through is located.

The shoot direction from the shoot pos is calculated, as far as I can tell, by:

Vector view_pos = ...;
Vector view_dir = ...;

// this may be overridden to an enemy pos if you're looking roughly at them i think
Vector aim_at = TraceFrom(view_pos, view_dir).HitPos;

Vector shoot_pos = ...;
Vector shoot_dir = (aim_at - shoot_pos).Normal();

This is what is responsible for all third-person weapons aiming too high, and, if it remains coupled, will cause a disparity between the calculated projectile impact time and actual projectile impact time. The larger the difference betwen view_pos and shoot_pos, the larger the disparity.