Garry's Mod Wiki

Revision Difference

Entity:GetHitBoxBone#518490

<function name="GetHitBoxBone" parent="Entity" type="classfunc"> <description>Gets the bone the hit box is attached to.</description> <realm>Shared</realm> <args> <arg name="hitbox" type="number">The number of the hit box.</arg> <arg name="group" type="number">The number of the hit box group. This should be 0 in most cases.&#xA;&#xA;Numbering for these groups start from 0. The total group count can be found with &lt;page&gt;Entity:GetHitBoxGroupCount&lt;/page&gt;.</arg>⤶ <arg name="group" type="number">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 <page>Entity:GetHitBoxGroupCount</page>.</arg>⤶ </args> <rets> <ret name="" type="number">The number of the bone. Will be nil if the hit box index was out of range.</ret> </rets> </function> <example> <code> 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 </code> <output>Hit box group 0, hit box 0 is attached to bone ValveBiped.Bip01_Head1, etc.</output> </example>