Hitbox

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit
Hitbox.jpg

A hitbox is an invisible box (or more often a series of boxes) which define the rough shape of a model for purposes of damage-based collision detection. A typical model within a game is much too high-poly to perform real-time hit calculations on, so hitboxes are used instead.

A hitbox is different from a bounding box in that it is more complex and closer to the model's visible shape. The bounding box is used for movement-based collision detection, and is usually literally a single box.

Creating Hitboxes

There are a couple ways of creating hitboxes. You can create them manually from scratch through the .qc commands or allow HLMV HLMV to auto-generate a set for you and then modify them from there. If your QC file is getting cluttered, the best way to keep your QC files organized is to create a hitbox.qci file which contains your hitbox data. You can link to it from your model's primary QC file with $include hitbox.qci.

Console Commands

sv_showhitboxes <integer>
Displays the server-side hitboxes of the specified player index, bypassing any net_fakelag. Generates a lot of traffic, so should only be used on local servers.
This has been removed from Valve's games due to the confusion it causes with regard to lag compensation, but is still in the mod SDK.

See also


Stub

This article or section is a stub. You can help by adding to it.