Tuesday, January 29, 2013

BodyGroup Usage in Source


Dismemberment is one of the new features I've added to Underhell. The game take's advantage of Source's implementation of bodygroups. A bodygroup is an index of a specific mesh within a model. This index can be used to toggle the presence of a mesh, or altogether swap it out in real time.

For dismemberment, a hitbox and the corresponding model bodygroup for the damaged npc is either swapped out or toggled off to demonstrate harm. The corresponding model for that limb is then instantiated as its own object.



As seen, bodygroups provide an easy implementation for gore, but also nice way to randomize the appearance (and sometimes the behavior of ) the same npc type. For example, below we have a standard soldier npc with randomized bodygroups on spawn. On spawn the following attributes are decided: health, armor, weapon, skin, extra equipment, and ( for our zombie friends) any limbs that they might already be missing.


Even hitboxes are swapped out:

No comments:

Post a Comment