[TF2] Improved huntsman arrow hitbox selection (no raycast approach) #1600
      
        
          +24
        
        
          −10
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Description
fixes ValveSoftware/Source-1-Games/issues/5904
supersedes #634
alternative: #1593 (simpler solution)
this pr's solution:

- find point on the arrow's trajectory line that's closest to the hitbox centre
- from that trajectory point, find distance to closest point on the hitbox's surface
- no intersection tests (a lot cheaper)
solution in #1593 (cross product):

- from the arrow's impact point, raycast to hitbox origin
- from that raycast's intersection point, find perpendicular distance to arrow's trajectory line
solution in a4f7b4f (projection):

- finds point on the trajectory line that's closest to the hitbox origin
- from that trajectory point, raycast to hitbox origin (to get raycast distance)
original behaviour:

- shift arrow's impact point 16 units forward
- from that point, raycast to hitbox origin (to get raycast distance)
- this can easily give unintuitive results (frustrating to both the user and the victim)
- bug: hitboxes are treated as axis-aligned boxes rather than oriented boxes!!!