hitbox_t
The game's hitbox record (CHitBox) returned by e:hitbox(index) and tr.hitbox.
Returned by e:hitbox(index) and tr.hitbox. It is the game's own hitbox record from the model (CHitBox), read in place, together with the entity it was reached through.
| Member | Returns |
|---|---|
hb:name(), hb:bone_name(), hb:surface_property() | String. |
hb:center() | World-space centre as a vector, or nil; see below. |
hb.mins, hb.maxs | Bone-space bounds as vector copies. |
hb.shape_radius | Shape radius. |
hb.group_id | Hit group; see below. |
hb.shape_type | 0 box, 1 sphere, 2 capsule. |
hb.hitbox_index | Hitbox index. |
Fields are read-only.
hb:center() places the hitbox on its entity's bones as they are cached now, without forcing a bone update: the centre of the shape the game traces for it. A capsule's centre is the midpoint of its two transformed ends, a sphere's is its transformed mins, and a box's is the transformed midpoint of mins and maxs. It returns nil when the entity, model, skeleton or bone data is unavailable, or when the hitbox is no longer an element of the entity's current hitbox set.
Hit groups: 0 generic, 1 head, 2 chest, 3 stomach, 4/5 arms, 6/7 legs, 8 neck, 10 gear.
A hitbox_t references live model data. Do not retain it across callbacks; call e:hitbox(index) again instead.
