fr1kin

GetHitboxCenter

Jun 22nd, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local function GetHitboxCenter( ent, hitbox )
  2.     local bpos, bang = ent:GetBonePosition( ent:GetHitBoxBone( hitbox, 0 ) );
  3.     local mins, maxs = ent:GetHitBoxBounds( hitbox, 0 );
  4.     local matrix = {
  5.         [0] = Vector( 0, 0, 0 ),
  6.         [1] = Vector( 0, 0, 0 ),
  7.         [2] = Vector( 0, 0, 0 ),
  8.     };
  9.     AngleMatrix( bang, matrix );
  10.     local rmins, rmaxs = Vector( 0, 0, 0 ), Vector( 0, 0, 0 );
  11.     RotateVector( mins, matrix, rmins );
  12.     RotateVector( maxs, matrix, rmaxs );
  13.     return bpos + ( ( rmins + rmaxs ) / 2 );
  14. end
Advertisement
Add Comment
Please, Sign In to add comment