HLMV create hitboxes: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
If you are starting from scratch, you can use HLMV to create a base set of hitboxes, and then modify them to fit your models needs. This page will take you step by step through the process. | If you are starting from scratch, you can use HLMV to create a base set of hitboxes, and then modify them to fit your models needs. This page will take you step by step through the process. {{warning|you will need a model that compiles properly and has a least 1 bone that the geometry is skinned to.}} | ||
== Auto Generating hitboxes == | == Auto Generating hitboxes == | ||
The first thing we'll do is get HLMV to create a set of hitboxes for us. When it does this it will create a hitbox for every bone that has geometry skinned to it, and will fit the hitbox around that geometry. | The first thing we'll do is get HLMV to create a set of hitboxes for us. When it does this it will create a hitbox for every bone that has geometry skinned to it, and will fit the hitbox around that geometry. | ||
#Open HLMV and load your model. From the Render tab press <code>CTRL+H</code> or select the <code>Hit Boxes</code> checkbox to view the hitboxes | #Open HLMV and load your model. From the Render tab press <code>CTRL+H</code> or select the <code>Hit Boxes</code> checkbox to view the hitboxes {{clr}} [[Image:Hlmv_hitboxes_01.jpg]] | ||
#Select the <code>Bones</code> tab. If you did not create hitboxes in your <code>.qc/.qci</code> file(s) then the <code>Auto-Generate Hitboxes</code> checkbox should be ON. If you have specified some hitboxes, turning on the auto-generation will do nothing. {{clr}} [[Image:Hlmv_hitboxes_02.jpg]] | |||
#Select the <code>Bones</code> tab. If you did not create hitboxes in your <code>.qc/.qci</code> file(s) then the <code>Auto-Generate Hitboxes</code> checkbox should be ON. If you have specified some hitboxes, turning on the auto-generation will do nothing. | #With the auto-generated hitboxes visible, click <code>Generate QC</code> button. This will copy the .qc commands needed to create the auto-generated hitboxes into your clipboard. {{clr}} [[Image:Hlmv_hitboxes_03.jpg]] | ||
#With the auto-generated hitboxes visible, click <code>Generate QC</code> button. This will copy the .qc commands needed to create the auto-generated hitboxes into your clipboard. | |||
#Open your model's <code>.qc</code> or create a new <code>hitbox.qci</code> file with your favorite text editor. <code>CTRL+V</code> to paste the autogenerated .qc lines into the file, save it, and recompile your model. It's a good idea to format the pasted commands into something more legible, especially if you plan on modifying the hitboxes. It should look something like this: | #Open your model's <code>.qc</code> or create a new <code>hitbox.qci</code> file with your favorite text editor. <code>CTRL+V</code> to paste the autogenerated .qc lines into the file, save it, and recompile your model. It's a good idea to format the pasted commands into something more legible, especially if you plan on modifying the hitboxes. It should look something like this: | ||
<syntaxhighlight lang="cpp"> | |||
$surfaceprop "default" | <br>// .qc block generated by HLMV begins. | ||
$hboxset "default" | <br>$surfaceprop "default" | ||
$hbox 0 "head" -14.83 -11.24 -23.58 32.59 11.24 9.46 "head" | <br>$hboxset "default" | ||
$hbox 0 "spine1" -33.32 -20.38 -40.78 33.32 20.38 40.78 "spine1" | <br>$hbox 0 "head" -14.83 -11.24 -23.58 32.59 11.24 9.46 "head" | ||
// .qc block generated by HLMV ends. | <br>$hbox 0 "spine1" -33.32 -20.38 -40.78 33.32 20.38 40.78 "spine1" | ||
<br>// .qc block generated by HLMV ends. | |||
</syntaxhighlight> | |||
== Creating new hitboxes and hitbox sets== | == Creating new hitboxes and hitbox sets== | ||
Line 28: | Line 27: | ||
Once you have all of your hitboxes and sets added, it's much faster to use HLMV to edit the scale and position of them. You can do it directly in the .qc file, but it will require recompiling the model many times to review your changes and thus is a much more inefficient way of accomplishing the same thing. | Once you have all of your hitboxes and sets added, it's much faster to use HLMV to edit the scale and position of them. You can do it directly in the .qc file, but it will require recompiling the model many times to review your changes and thus is a much more inefficient way of accomplishing the same thing. | ||
#Open your model in HLMV, turn the hitboxes on, flip over to the <code>Bones</code> tab | #Open your model in HLMV, turn the hitboxes on, flip over to the <code>Bones</code> tab {{clr}} [[Image:Hlmv_hitboxes_04.jpg]] | ||
#Select the set that contains the hitbox you would like to edit, and then the joint it is attached to. You'll see the boxes describing the hitboxes' position and size fill out. {{note|While this info represents what is defined in the .qc, it is presented differently. The .qc script defines the 2 opposite corners of the hitbox in relation to the bones pivot. HLMV converts that info into a more user friendly <code>size</code> and <code>origin</code>, or offset if you will, in relation to the bone's pivot.}} <br>[[Image:Hlmv_hitboxes_05.jpg]] | |||
#Select the set that contains the hitbox you would like to edit, and then the joint it is attached to. You'll see the boxes describing the hitboxes' position and size fill out. | #Edit the <code>Origin</code> and <code>Size</code> blocks and press the <code>Update Hitbox</code> button to see your changes. <br>[[Image:Hlmv_hitboxes_06.jpg]] | ||
#Edit the <code>Origin</code> and <code>Size</code> blocks and press the <code>Update Hitbox</code> button to see your changes. | |||
#Repeat until all of the hitboxes in all of your sets are looking good. | #Repeat until all of the hitboxes in all of your sets are looking good. | ||
#Click <code>Generate QC</code> to copy these new settings into your clipboard again and then replace your old hitbox info with it. Recompile your model. High-five someone. | #Click <code>Generate QC</code> to copy these new settings into your clipboard again and then replace your old hitbox info with it. Recompile your model. High-five someone. | ||
== See also == | |||
* <code>[[$hbox]]</code> | |||
* <code>[[$hboxset]]</code> | |||
* <code>[[$include]]</code> | |||
[[Category:Modeling]] |
Revision as of 19:41, 27 June 2012
If you are starting from scratch, you can use HLMV to create a base set of hitboxes, and then modify them to fit your models needs. This page will take you step by step through the process.

Auto Generating hitboxes
The first thing we'll do is get HLMV to create a set of hitboxes for us. When it does this it will create a hitbox for every bone that has geometry skinned to it, and will fit the hitbox around that geometry.
- Open HLMV and load your model. From the Render tab press
CTRL+H
or select theHit Boxes
checkbox to view the hitboxes - Select the
Bones
tab. If you did not create hitboxes in your.qc/.qci
file(s) then theAuto-Generate Hitboxes
checkbox should be ON. If you have specified some hitboxes, turning on the auto-generation will do nothing. - With the auto-generated hitboxes visible, click
Generate QC
button. This will copy the .qc commands needed to create the auto-generated hitboxes into your clipboard. - Open your model's
.qc
or create a newhitbox.qci
file with your favorite text editor.CTRL+V
to paste the autogenerated .qc lines into the file, save it, and recompile your model. It's a good idea to format the pasted commands into something more legible, especially if you plan on modifying the hitboxes. It should look something like this:
<br>// .qc block generated by HLMV begins.
<br>$surfaceprop "default"
<br>$hboxset "default"
<br>$hbox 0 "head" -14.83 -11.24 -23.58 32.59 11.24 9.46 "head"
<br>$hbox 0 "spine1" -33.32 -20.38 -40.78 33.32 20.38 40.78 "spine1"
<br>// .qc block generated by HLMV ends.
Creating new hitboxes and hitbox sets
The easiest way to create new hitboxes or hitbox sets is to simply cut/copy & paste the lines in the .qc that refer to a hitbox on the bone you'd like to add the hitbox to.
You can create a new hitbox set by adding $hboxset "your_set_name_here"
and then cut/copy & pasting the .qc commands for an existing hitbox below.
Once you've finished adding the all the hitboxes and sets you need, save the file and recompile the model.
Modifying your hitboxes with HLMV
Once you have all of your hitboxes and sets added, it's much faster to use HLMV to edit the scale and position of them. You can do it directly in the .qc file, but it will require recompiling the model many times to review your changes and thus is a much more inefficient way of accomplishing the same thing.
- Open your model in HLMV, turn the hitboxes on, flip over to the
Bones
tab - Select the set that contains the hitbox you would like to edit, and then the joint it is attached to. You'll see the boxes describing the hitboxes' position and size fill out.
Note:While this info represents what is defined in the .qc, it is presented differently. The .qc script defines the 2 opposite corners of the hitbox in relation to the bones pivot. HLMV converts that info into a more user friendly
size
andorigin
, or offset if you will, in relation to the bone's pivot. - Edit the
Origin
andSize
blocks and press theUpdate Hitbox
button to see your changes. - Repeat until all of the hitboxes in all of your sets are looking good.
- Click
Generate QC
to copy these new settings into your clipboard again and then replace your old hitbox info with it. Recompile your model. High-five someone.