Question Regarding Ragdoll Physics

So I’m attempting to create a ragdoll of the Halo 2 Anniversary Elite that was in Killer Instinct, but once compiled and spawned in Garry’s Mod there are possibly three issues with it that I’ve been unable to solve (Pictures below to illustrate them):

  1. It doesn’t behave like a ragdoll, but more like a rigid statue.
  2. The collision box doesn’t align with the model.
  3. The only bone that I can interact with using the Ragdoll Mover tool is the pelvis bone, and it’s pivot point lies outside the model.

1 - Not behaving like a Ragdoll

When I spawn it in, it doesn’t collapse as a heap on the floor and the body parts can’t move independently. It’s like a statue instead, similar to a green ring effect but without the green ring.

Example 1

(I’m aware that the model is a bit big, but I think I just need to scale it down in Blender, and export again)

Another example is that the model has the Precision Mesh over it as though it were a solid entity. From my experience ragdolls don’t usually have the Precision Mesh over them: Example 2.

I do have bones present within the model in some form however (Example 3), and they can be moved to pose the model if I edit the bones manually (Example 4).


2 - Collision Box Misalignment

I’ve tested walking my character up against the model, and I can walk through some parts of it (such as the arms) whilst others seem solid (The head and chest). Also, the Physgun interacts with it when it shouldn’t, such as shooting it between its knees and still selecting the model: Example 5.

At other times the physgun doesn’t select the model despite aiming at it: Example 6.

I’ve also checked and ensured that the collision model is the same size and position as the reference model in Blender.


3 - Can’t Interact with Bones

Basically it seems as though the only bone that can be moved with the ragdoll mover tool is the pelvis, but the transforms appear at the model’s feet rather than where the bone is in the model: Example 7.

The only thing that comes to mind for me here is that the position of the transforms coincide with the origin of my model’s mesh and armature in Blender. Is that the problem here?


I don’t know what is causing these issues, but I have a suspicion that it’s the collision model. I did a comparison to a model that works correctly in Half Life Model Viewer showing the collision models:

A working model example.
My attempt.

Like…lolwut

Anyway, if you look at the drop down menu in the bottom left hand side of my model, you’ll see that the only bone there is Pelvis. If you look at the same menu in the working model, there’s much more (See here).

The fact that the only bone I can interact with using the Ragdoll mover tool is the Pelvis, and the fact that the Pelvis is the only bone in that menu, must be related, right? Anyway any guidance that can be offered would be greatly appreciated. I’ve been scouring tutorials and other help threads, but I haven’t found solutions to these specific problems. I’m also using Blender too. I’m quite new to all this stuff; last month I knew nothing, and this is the first ragdoll I’ve attempted to make.

QC File for the model:


$ModelName "h2a_elite.mdl"

$BodyGroup "Armour"
{
	studio "elite_armour.smd"
	blank
}

$Model "Halo2Elite" "elite_combat_reference.smd" {

	eyeball "eye_right" "head" -27.13 -314.46 901.23 "eye_right" 1 4 "iris_unused" 0.63
	eyeball "eye_left" "head" 27.13 -314.46 901.23 "eye_left" 1 -4 "iris_unused" 0.63

}
	
$SurfaceProp "flesh"

$Contents "solid"

$collisionjoints "elite_collision.smd"

$EyePosition 0 0 70

$MaxEyeDeflection 90

$MostlyOpaque

$CDMaterials "models\h2a\elite"

$Attachment "eyes" "head" 0.00 -314.46 901.23 absolute
$Attachment "mouth" "head" 0.80 -5.80 -0.15 rotate 0 -80 -90

$Sequence ragdoll "elite_idle.smd"

I can provide Blend files or smd’s if requested.

Thanks.


Edit:

So I figured it out. I built the collision model wrong according to this:

To export the collision model we need to be a little careful. First we have to make sure that each convex part of the collision model is a separate object in Blender. In object mode, when you select the object (right-click), only that part should highlight. If two parts highlight from a single click, then they are in fact both in the same object. You can separate them by going into edit mode, selecting all vertices in one part of the object, and pressing the P key.

I had the collision model all as one object. Breaking it up into distinct objects and exporting seems to have generated a working ragdoll. All those problems are gone.


So I suppose I have only one thing to ask now: Testing it, it seems to bounce around endlessly and quite violently. Any suggestions for how I can tone that down a bit?

That is a simple fix. You are missing two things that are required by the engine to make the model have ragdoll physics:

  1. Joint constraints
  2. A physics model

Here is an example:


$collisionjoints "male_01_physics.smd"
{
	$mass 90
	$inertia 10
	$damping 0.01
	$rotdamping 1.5


	$jointconstrain "ValveBiped.Bip01_Spine2" x limit -48 48 0
	$jointconstrain "ValveBiped.Bip01_Spine2" y limit -25 25 0
	$jointconstrain "ValveBiped.Bip01_Spine2" z limit -25 50 0

	$jointconstrain "ValveBiped.Bip01_R_UpperArm" x limit -39 39 0
	$jointconstrain "ValveBiped.Bip01_R_UpperArm" y limit -79 95 0
	$jointconstrain "ValveBiped.Bip01_R_UpperArm" z limit -93 23 0

	$jointconstrain "ValveBiped.Bip01_L_UpperArm" x limit -30 30 0
	$jointconstrain "ValveBiped.Bip01_L_UpperArm" y limit -95 84 0
	$jointconstrain "ValveBiped.Bip01_L_UpperArm" z limit -86 26 0

	$jointconstrain "ValveBiped.Bip01_L_Forearm" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Forearm" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Forearm" z limit -149 4 0

	$jointconstrain "ValveBiped.Bip01_L_Hand" x limit -37 37 0
	$jointconstrain "ValveBiped.Bip01_L_Hand" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Hand" z limit -57 59 0

	$jointconstrain "ValveBiped.Bip01_R_Forearm" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Forearm" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Forearm" z limit -149 4 0

	$jointconstrain "ValveBiped.Bip01_R_Hand" x limit -60 60 0
	$jointconstrain "ValveBiped.Bip01_R_Hand" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Hand" z limit -57 70 0

	$jointconstrain "ValveBiped.Bip01_R_Thigh" x limit -12 12 0
	$jointconstrain "ValveBiped.Bip01_R_Thigh" y limit -8 75 0
	$jointconstrain "ValveBiped.Bip01_R_Thigh" z limit -97 32 0

	$jointconstrain "ValveBiped.Bip01_R_Calf" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Calf" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Calf" z limit -12 126 0

	$jointconstrain "ValveBiped.Bip01_Head1" x limit -20 20 0
	$jointconstrain "ValveBiped.Bip01_Head1" y limit -25 25 0
	$jointconstrain "ValveBiped.Bip01_Head1" z limit -13 30 0

	$jointconstrain "ValveBiped.Bip01_L_Thigh" x limit -12 12 0
	$jointconstrain "ValveBiped.Bip01_L_Thigh" y limit -73 6 0
	$jointconstrain "ValveBiped.Bip01_L_Thigh" z limit -93 30 0

	$jointconstrain "ValveBiped.Bip01_L_Calf" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Calf" y limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Calf" z limit -8 126 0

	$jointconstrain "ValveBiped.Bip01_L_Foot" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_L_Foot" y limit -19 19 0
	$jointconstrain "ValveBiped.Bip01_L_Foot" z limit -15 35 0

	$jointconstrain "ValveBiped.Bip01_R_Foot" x limit 0 0 0
	$jointconstrain "ValveBiped.Bip01_R_Foot" y limit -25 6 0
	$jointconstrain "ValveBiped.Bip01_R_Foot" z limit -15 35 0
}


[editline]27th June 2016[/editline]

As for the scaling, refrain from scaling the model through Blender. Instead, scale the model with the “$scale” command. This will help you avoid any animation/physics model related issues that can occur.