$jointconstrain: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(clean up)
(changed example to real biped ragdoll example)
Line 1: Line 1:
The [[QC Command]] [[$jointconstrain]] is used to set the limit of a joint's movement when compiling the [[$collisionmodel]].  
[[$jointconstrain]] is a parameter of The [[QC Command]] [[$collisionjoints]], used to set the limit of a joint's movement when compiling a [[jointed collision model]].  


== Syntax ==
== Syntax ==
  $jointconstrain <bone_name> <axis> <allow_option> <min_angle> <max_angle> <friction>
  $jointconstrain <bone_name> <axis> <allow_option> <min_angle> <max_angle> <friction>
where
where
; <bone_name> : {{todo|is the name of the 'child' bone as opposed to the 'parent' bone of the joint? - see example}}.
; <bone_name> : is the name of the 'child' bone as opposed to the 'parent' bone of the joint.
; <axis> : specifies either the X, Y, or Z axis of rotation.
; <axis> : specifies either the X, Y, or Z axis of rotation.
; <allow_option> : can be one of three values:
; <allow_option> : can be one of three values:
Line 16: Line 16:
=== Example ===
=== Example ===


For example, to constrain the movement of ''joint_spine'' within a range of 20 to 100 degrees on the X-axis, with a friction of 0.20:
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.
$jointconstrain "joint_spine" x limit 20.00 100.00 0.20.
[[$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
//etc
}




[[Category:QC Commands]]
[[Category:QC Commands]]

Revision as of 17:26, 30 March 2008

$jointconstrain is a parameter of The QC Command $collisionjoints, used to set the limit of a joint's movement when compiling a jointed collision model.

Syntax

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

where

<bone_name>
is the name of the 'child' bone as opposed to the 'parent' bone of the joint.
<axis>
specifies either the X, Y, or Z axis of rotation.
<allow_option>
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.
<min_angle>
specifies the minimum angle of rotation about <axis> in degrees. (No lower than -360).
<max_angle>
specifies the maximum angle of rotation about <axis> in degrees. (No higher than 360).
<friction>
specifies the Friction value
Todo: scale? integer?
.

Example

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
	
	//etc
	}