Garry's Mod Wiki

Entity:GetHitBoxBone

  number Entity:GetHitBoxBone( number hitbox, number hboxset )

Description

Gets the bone the hit box is attached to.

Arguments

1 number hitbox
The number of the hit box.
2 number hboxset
The number of the hit box set. This should be 0 in most cases.

Numbering for these sets start from 0. The total amount of sets can be found with Entity:GetHitBoxSetCount.

Returns

1 number
The number of the bone. Will be nil if the hit box index was out of range.

Example

local ply = LocalPlayer() local numHitBoxSets = ply:GetHitboxSetCount() for hboxset=0, numHitBoxSets - 1 do local numHitBoxes = ply:GetHitBoxCount( hboxset ) for hitbox=0, numHitBoxes - 1 do local bone = ply:GetHitBoxBone(hitbox, hboxset ) print( "Hit box set " .. hboxset .. ", hitbox " .. hitbox .. " is attached to bone " .. ply:GetBoneName(bone) ) end end
Output: Hit box set 0, hit box 0 is attached to bone ValveBiped.Bip01_Head1, etc.