Adding Physics Effects in VHE
I'll describe the method briefly. We import our map into Blender, generate an animation with the Bullet physics engine, compile the model and add it back to the map as an entity. We won't use BMOD, or AMXX at all for that matter. You could of course use 3D Max, but Blender is free and…

I'll describe the method briefly. We import our map into Blender, generate an animation with the Bullet physics engine, compile the model and add it back to the map as an entity. We won't use BMOD, or AMXX at all for that matter. You could of course use 3D Max, but Blender is free and makes more sense commercially.
A couple of examples of this method:
What will we need?
Valve Hammer Editor – a map editor, obviously;
BSP Viewer – needed to export the map to 3ds;
Blender – a wonderful 3D editor with a built-in Bullet;
rba2ba – a Python script written by the Czech Jonatan Matejka. Needed to generate the skeleton of the future model (Mirror, version for Blender 3D 2.8x);
Blender SMD Tools – to export our work to the usual SMD;
smdfix – fixes texture names and the UV map in the SMD.
Setting up our scene in VHE
Open the map in Hammer. Suppose we need to add a nice effect of crates falling because of a broken support. To do that, we draw a tower of three brushes with wooden crate textures and a couple of planks under it. One of the supports snaps. The author of the original article got this:

We compile our map to bsp (I recommend setting the -subdivide 512 parameter) and open it in BSP Viewer.

Click File -> Export -> 3DS File. Leave the Export Materials checkbox ticked. Save the 3ds file. If you built the map with the textures included (excluded the wad file), click File -> Export -> Bitmaps. You can leave the options unchanged. If the map does take its materials from a wad, you'll have to unpack the archive's contents with a dedicated program (Wally or GCFScape will do). Now that you have a 3ds with all the bmp textures, you can move on to the next step.
Modeling in Blender
Before getting to the juiciest part, I recommend learning the interface and controls of this program. Users with basic knowledge will have a much easier time than a newbie opening Blender for the first time.
Install and launch the editor. Enable the rba2ba and Blender SMD Tools plugins (File -> User Preferences -> Addons and click Install from File). Now we import our crates into Blender. Click File -> Import -> 3D Studio (.3ds). Switch to Blender Game.

Select any crate. Go to Physics in the object properties (the last icon in the right-hand menu).

Set Physics Type: to Rigid Body, and Collision Bounds to Box (or Convex Hull if the mesh doesn't have a primitive shape). You can additionally set the object's mass (Mass). Do the same with the other crates.
Select all the crates and press Shift+Ctrl+Alt+C, then choose Origin to Geometry.
Go back to the right-hand menu and this time click the World icon

Here we can change the gravity (Gravity), FPS and physics steps (Physics Steps). Delete the plank under the crates. Now press P. Did the tower collapse? Great. Esc takes you back to edit mode. If the crates fall through the ground, change the Substeps parameter or select the surface the crates fall onto and set an appropriate Collision Bounds.

When you're happy with the physics animation, tick Game -> Record Animation. Run the animation again. Then delete all objects except the crates. Select the remaining boxes and press space. In the input field type Rigid body anim to bone anim (this is the script you installed, by our Czech friend, who is the author of the original of this article).

Then group the meshes with Ctrl+G. Now File -> Export -> Source Engine, Scene as configured. Getting an error? Check in the scene properties (right-hand menu, the icon with a sphere and a cylinder) that the export directory path (Export Path) is set. Don't forget to set the SMD format. Phew...
Run smdfix via a batch file or the command line. You can import the resulting SMDs (in your usual 3D editor) and check the animation. If everything looks good, move on to the final steps.
Compiling the MDL
Create a text document with the .qc extension and write the following code into it:
$cd "." // относительный Путь к ресурсам
$body "body" "out" // body - название меши в mdl, out - путь к smd меши
$sequence "idle" "anims/ArmatureAction" fps 50 // idle - название анимации в mdl, anims/ArmatureAction - путь к smd анимации, fps - частота кадров в анимацииYou can read more about qc scripting here
Compile our qc code. The compiler to mdl for HL (via studiomdl.exe). A compile error may appear because of the limit on the number of frames in an animation. In that case you'll have to go back to Blender and lower the FPS value in the scene parameters.
Importing the animation into VHE
Now we can go back to VHE. Open our map and replace the old static crate brushes with a new entity of the class “cycler_sprite” . Set the parameters sequence 1, framerate 1. I won't describe how to add triggers and point them at the entity. All of that can be found in the many VHE manuals or in the original source. The only thing I can add is that to calculate the animation duration you can use a simple and, in my opinion, obvious formula: time = number of frames / fps, where the number of frames can be seen in an mdl viewer or by opening the animation SMD in a text editor.

Source: http://tvorbamap.cz/articles.php?article_id=117


