From Valve Developer Community
Jump to: navigation, search

$jointconstrain is a parameter of the $collisionjoints QC command. It is used to set the limit of a named bone's movement relative to its parentbone in a jointed collision model.


$jointconstrain <bone_name> <axis> <allow_option> <min_angle> <max_angle> <friction>


is the name of the 'child' bone as opposed to the 'parent' bone of the joint.
specifies either the X, Y, or Z axis of rotation.
can be one of three values:
  • Free : ensures the joint can move between a <min_angle> of -360 and a <max_angle> of 360, with a selectable <friction>. Ignores user specified <min_angle> and <max_angle> values.
  • Fixed : ensures the joint does not move at all. <min_angle>, <max_angle> and <friction> values are effectively locked to "0".
  • Limit : ensures the joint is completely customizable. The user must specify <min_angle>, <max_angle> and <friction> values.
specifies the minimum angle of rotation about <axis> in degrees. (No lower than -360).
specifies the maximum angle of rotation about <axis> in degrees. (No higher than 360).
specifies the Friction value
Todo:scale? integer?


For example, the right-hip joint of a valvebiped is defined by constraining the movement of valvebiped.bip01_r_thigh in relation to its parent bone (which would be valvebiped.bip01_pelvis). Notice we need a separate $jointconstraint for each axis of rotation.

$collisionjoints "phymodel.smd" {
	$mass 70.0
	$inertia 10.00
	$damping 0.01
	$rotdamping 1.50
	$rootbone "valvebiped.bip01_pelvis"
	$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"

 	$jointconstrain "valvebiped.bip01_r_thigh" x limit -12.00 12.00 0.00  // from -12 to 12 degrees in the X-axis - twist knee left/right
 	$jointconstrain "valvebiped.bip01_r_thigh" y limit  -8.00 75.00 0.00  // from -08 to 75 degrees in the Y-axis - spread knees
 	$jointconstrain "valvebiped.bip01_r_thigh" z limit -97.00 32.00 0.00  // from -97 to 32 degrees in the Z-axis - raise knee
Warning.png Warning: These axes of rotation are always local, respective to the orientation of each bone. This means that, for instance, what the X axis is for one model's joint may be different for another.