Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Creating Breakable Models

From HalfLife 2 Knowledge Base

Jump to: navigation, search

by Sideeffect

Thanks to Cannonfodder for showing me the .qc commands.

Contents


In this tutorial I'm not going to go through every step of the modeling process, you should already know how to do this.

You're going to need to make a .mdl for each breakable object you have like this:

Image:Bt_model_pieces.jpg

Modeling the Objects

Make your breakable models, make sure you model them over the original model so that when the pieces spawn they'll be in the right places.

My model is made up of the lantern with broken glass and 5 other glass gib models:

Image:Bt_model_parts.jpg

After you're done modeling the pieces make a collision model for each one of those pieces. Look on how to make collision models in Cannonfodder's tutorial if you don't know how to make one already.

Image:Bt_model_parts_collision.jpg

Setting the Origins

Make sure you set this up correctly, this step is very important. If you want your parts to spawn at the right spots you have to make sure the origins of all your objects are in the same spot as the original object.

You should already know how to do this with the program you're using, if not look through the help files or tutorials online.

This picture is using 3d Studio Max 6:

Image:Bt_model_parts_origin.jpg

The origin for my objects are all at 0, 0, 0. That goes for it's position and rotation. After you've gotten everything set up export each object to a .mdl.

Making the .qc file

To make your model break you have to add this line to your .qc file.

$collisiontext { 
break { "model" "(yourfolder)\(yourmodel)" "health" "1" "fadetime" "0" }
}

If you want more just add another break line under $collisiontext.

  • "health" "#" will set your objects health if you want it to break more or want the object to disappear when shot.
  • "fadetime" "#" will set how long it takes for your objects to fade away.

Also the health of your models are affected by the keyvalues

$keyvalues { "prop_data" { "base" "(propdata)" } }

These can be found in propdata.txt in the gcf file, scripts/propdata.txt

Here is my .qc file to use as a refrence.

$modelname lantern/lantern.mdl

$cdmaterials models/lantern
  //$staticprop
$surfaceprop "metal"
$keyvalues { "prop_data" { "base" "Plastic.Medium" } }
$scale 1.0
$body studio "models/lantern/lantern.smd"

$sequence idle "models/lantern/lantern_idle" fps 1

$collisiontext { 
break { "model" "lantern\lantern_p1" "fadetime" "0" }
break { "model" "lantern\lantern_gib1" "health" "1" "fadetime" "0" }
break { "model" "lantern\lantern_gib2" "health" "1" "fadetime" "0" }
break { "model" "lantern\lantern_gib3" "health" "1" "fadetime" "0" }
break { "model" "lantern\lantern_gib4" "health" "1" "fadetime" "0" }
break { "model" "lantern\lantern_gib5" "health" "1" "fadetime" "0" }
}

$collisionmodel "models/lantern/lantern_phys.smd" {
        $Mass 10
    $concave
}


When you're done setting up your .qc files compile em all and you've got a breakable object.

Personal tools