Entity/GetHitBoxBone

From Garry's Mod
Jump to: navigation, search
 Entity:GetHitBoxBone( )

Contents

Description

Gets the bone the hit box is attached to.

Arguments

number hitbox

The number of the hit box.

Arguments

number group

The number of the hit box group. This should be 0 in most cases.

Numbering for these groups start from 0. The total group count can be found with Entity:GetHitBoxGroupCount.

Returns

number

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

Examples

Example

local ply = LocalPlayer()
local numHitBoxGroups = ply:GetHitBoxGroupCount()

for group=0, numHitBoxGroups - 1 do
  local numHitBoxes = ply:GetHitBoxCount( group )
    
  for hitbox=0, numHitBoxes - 1 do
    local bone = ply:GetHitBoxBone(hitbox, group)

    print( "Hit box group " .. group .. ", hitbox " .. hitbox .. " is attached to bone " .. ply:GetBoneName(bone) )
  end
end

Output:

Hit box group 0, hit box 0 is attached to bone ValveBiped.Bip01_Head1, etc.
Personal tools
Navigation