Custom animated prop with dynamic collisions using blender

Creating an animated Prop with dynamic collisions for source in Blender

Blender overview

Preperations

-Install Blender, Source Tools and Crowbar

Basics

  • After Loading up Blender press A twice and hit the deletekey
  • Create or import your geometry
  • All geometry has to be joined together! In

Object Mode

  • After placing your first bone create a sphere aswell. select the bone again and go to

.
Scroll down and select the sphere under Custom Shape

  • Alsways duplicate bones in

Edit Mode from your base bone with Shift + D and parent them to your base bone under

Animating (I took this straight from VALVE Developer Community)

Creating an armature

“Armature” is Blender’s term for a skeleton.

  1. If you aren’t in

Object Mode, select it from the bar at the bottom of the 3D View.
2. Add a new armature with ⇧ Shift+A >

Armature.
3. To prevent the mesh hiding your bones, go to

Object Properties, find the Display panel, and enable the “X-Ray” option.
4. Enter

Edit Mode with Tab ⇆. This is where you will edit the bones in the armature.
- To add bones, [DEL]use ⇧ Shift+A (add a new root), E (extrude from the selected bone/bones), or Ctrl+LMB (create a new bone where you click).[/DEL]** ⇧ Shift+D and parent them together. Move the whole bone for animating.**
- To move one end of a bone while leaving the other in place, select one of its connector spheres.
- To rename a bone, go to

Bone Properties. To have Blender label bones in the 3D view, go to

Armature Properties, find the Display panel and enable “Names”.

Skinning

In Blender, the link between mesh and bones is called a “skin”. The Blender Source Tools support three methods of creating one:

Bone parent

If your model is made up of rigid components, you can create it as a collection of separate objects and then parent each one to a bone.
1. Enter

Pose Mode and select the bone you want.
2. Select your mesh, then use ⇧ Shift to multi-select the armature.
3. Press Ctrl+P and choose “Bone”.
You can also set a bone parent via the Relations panel of (Icon)+(Icon) Object Properties.

Armature modifier

Modifiers affect objects without altering their underlying data, and the

Armature Modifier causes a mesh to be deformed by the pose of an armature. To add an one, select your mesh and go to

Object Modifiers.
The armature modifier can work in one or both of the following ways:

Envelopes

This is the easiest way to skin an organic mesh. Each bone automatically projects an “envelope” of influence, and by repositioning them and changing their Radius a fairly good skin can be created.
- To change a bone’s Radius, enable Envelope display from

Armature Properties then select its connector and scale it S as you would an object.

Weight mapping

A “weight map” defines how much influence each bone has over each vertex’s position (an envelope or bone parent simply generates one for you). If a vertex is weighted 50% to two bones, then the associated bones each have 50% control over it during animation.
In Blender, a Mesh’s weightmap is defined by

Vertex Groups with names matching bones on an associated Armature. The weightmaps of other object types cannot be directly edited.

Managing Vertex Groups:

  • Blender can generate and populate vertex groups automatically: select your Mesh, then your Armature, then hit Ctrl+P and choose the appropriate option from underneath “Armature Deform”. You can do this at any time, but if an Armature Modifier already existed remember to remove the new one from

Object Modifiers! USE THIS ! select “with Automatic Weights” and edit to your liking

  • To create or destroy groups manually, enter

Edit Mode and go to the Vertex Groups panel in

Mesh Properties.

Assigning to Vertex Groups:

  1. Select your object and enter

Weight Paint mode.
2. Choose a Vertex Group either with ⇧ Shift+LMB, which will offer a list of nearby bones, or from the Vertex Groups panel of

Mesh Properties.
3. Paint! You can control the brush settings from the Tool Shelf on the left side of the 3D View. If it isn’t visible, press T.
- You can also manually assign weights from the Vertex Groups panel while in

Edit Mode.

Animating

Only the animation of bones created in

Pose Mode will be exported. Whole-object animation will not make it out.THIS IS IMPORTANT
In Blender, animations are stored in

Actions. You can store any number in the same file but the UI for managing them is poor.
[DEL]To manage Actions, install the Blender Source Tools and use the new “SMD Export” panel in

Armature Properties.[/DEL]IGNORE THIS
To edit an Action, enter

Pose Mode, select the bones you want to animate and use I to create a keyframe for the first frame of your animation**(Alt + I to delete)**. Then change to another frame with the arrow keys or

Timeline and create more keyframes.

Now that you know all this create the following .SMDs:

1. MODELNAME_ref.smd
- this should contain your full model and all the bones but NO frames (set “start” and “end” to 0)
- Export this using the

Scene Export

2. MODELNAME_idle.smd
- the model isnt required but helps you so just leave it in (it wont be exported).
- create an animation with 1 frame (“start” = 0 “end” = 1) and set both frames to a key that has no movement
- Export this using the

Action Export

3. MODELNAME_ANIMATIONNAME.smd
- the model isnt required but helps you so just leave it in (it wont be exported).
- create an animation to your liking
- Export this using the

Action Export

4. MODELNAME_phys.smd
- create a seperate model that is at the same place as your main geometry but with simpler shape. Then delete your main geometry!!
- have it parented to the same bones (use

Weight Paint
- set NO frames (“start” and “end” to 0)
- Export this using the

Scene Export

Create a .QC file

It should look something like this:


$modelname mymodels/MODELNAME.mdl
$model "Body" "MODELNAME_ref.smd"
$cdmaterials "mytextures/"
$surfaceprop "glass"

$sequence "idle" "MODELNAME_idle.smd" fps 1 loop

$sequence "open" "MODELNAME_open.smd" fps 30

$sequence "close" "MODELNAME_close.smd" fps 30

$collisionjoints "glass_door_anim_phys.smd" //use this for moving collisions
//$collisionmodel							//use this for static collisions
{
   $Mass 100
   $concave
}

Simply Load this .QC in Crowbar under “Compile”.

I will also provide a example prop with all files.
download

These helped me a lot: