Compiling Models With Miscellaneous Joints (See Thread for Better Description)

Right, so I have no idea how to summarize this briefly, but basically, this is the situation:

I am making a gamemode that will incorporate the snapping on-and-off of variable parts, such as engines. I want to store the snap-point information in unlinked joints, as in the picture below (forgive the shitty model and texture, it’s a test model for figuring out mechanics of the game):


However, I have never compiled a model with such “miscellaneous joints” before, so I don’t know how I would construct my QC. I compiled with just the bone that has the mesh assigned to it (“base”) being defined in the QC ($hbox line), and the model compiled fine, but a quick check through with Lua’s Entity:LookupBone() shows that the model did not compile with these miscellaneous joints.

So I’m wondering how it can be done? I’m pretty certain it is possible, but I simply don’t know how one would do it.

Here’s the QC I’m using, so people with ideas can edit it at will. Taken and modified from the pop can model.

$cd "F:\Decompiled\Steampunk\Test Fighter"
$modelname "steampunk\ships	est_ship.mdl"
$model "Body" "ref.smd"
$cdmaterials "models\steampunk	est_ship/"
$hboxset "default"
$hbox 0 "base" -1.819  -1.912  -3.397  1.819  1.912  3.397
//$hbox 0 "point.steer" -1.175  -7.124  -1.587  1.829  0.933  2.029
//$hbox 0 "" -1.175  -7.124  -1.587  1.829  0.933  2.029
//$hbox 0 "effects.engine1" -1.175  -7.124  -1.587  1.829  0.933  2.029
//$hbox 0 "effects.engine2" -1.175  -7.124  -1.587  1.829  0.933  2.029
$surfaceprop "popcan"
$keyvalues  { prop_data { "base" "Metal.Small"  } } 
$sequence idle "idle" fps 30.00
$collisionmodel "phys.smd" {

    $mass 10.0
    $inertia 1.00
    $damping 0.00
    $rotdamping 0.00

(Also sorry if it’s the wrong section, not quite certain where a newbie question would go :blush:)

Yeah they’re being removed during compile. There’s a command to make them not remove, but I believe it would befar more easier to just declare an attachment for each

Would you care to elaborate on that?

My knowledge in regards to compiling models is pretty much limited to simple props and model-hacks. :v:

Just put attachment code to your QC

$attachment “attachmentname” “bonename” 0.00 0.00 -0.00 rotate 0.00 0.00 -0.00

For each of the bones you want to keep. What the compiler essentially does otherwise, is drop bones that don’t have multiple children and or aren’t rigged to a single vertex. Or something like that. But adding the attachments is the fastest, you could probably refine your code to use theattachments instead as well, as valve normally does.

Yay. Thank you so much. That’s exactly what I needed. :buddy:

False alarm.

I have a new complication.

It appears that the attachments are being offset by 90 degrees, and apparently the “rotate” line in the QC for attachments just rotates the point around its OWN origin, as opposed to the model’s origin.

Any ideas on how to fix this?

And if I make the ship bigger, the problem is equally larger.



if I were you, I’d take a glance at the model in the model viewer to see if the bones are there etc.

Well I know the bones are there, because doing an Entity:LookupAttachment() returns proper attachment IDs (engine 1 is attachment 3, engine 2 is attachment 4), so I know that the bones being there isn’t an issue.

Any other ideas? :saddowns:

Yeah I know the bones are there. The HLMV allows you to see exactly where the bones and attachments are though.

Are they linked to the main skeleton? And is that rigged to the model?

The HLMV shows the attachments to be in the exact same places as where they are in-game.

As to the linking: Am I supposed to link the attachment joints to the joint the model is rigged to? (IE, connect them all to the “base” joint)

Keep in mind I’ve never done anything quite like this, so I figured it wasn’t important whether or not the joints were rigged with bones, since they are never going to be animated.

[editline]23rd January 2011[/editline]

Wow I feel dumb.

I rerigged it so all the joints were connected by bones (the point.steer connected to the “base” [which is what the model is rigged to] and all the other points to point.steer) and recompiled. Looking in HLMV, everything seems to work now.

Going to go in-game and make sure, but that looks like it. Thanks a lot wraithcat. :love:


Yep. That was problem. Thank you so much wraithcat. :love::love::love:

Happy to help. It actually seems to be quite a common problem with a lot of stuff, that if something is not rigged or linked to the base bone it is rotated by 90°. Happens with physmodels on props most often.