$collisionjoints: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
{{stub}}
The [[QC command]] <code>[[$collisionjoints]]</code> is used to embed an animated and/or physically-simulated [[collision mesh]] in a model, for use in [[VPhysics]] calculations. It's most often used for ragdolls, but also works with canned animations.
The [[QC command]] [[$collisionjoints]] is used to setup the ragdoll or [[jointed collision model]].
{{note|[[Jointed collision model]]s use [[$collisionjoints]] instead of [[$collisionmodel]].}}
* See also [[Physics and Ragdolls]].


== Example Syntax==
{{tip|Use <code>vcollide_wireframe 1</code> to view collision meshes in-game.}}
[[$collisionjoints]] "bip01_phys.smd" {
[[$mass]] 115.0
[[$inertia]] 2.00
[[$damping]] 0.01
[[$rotdamping]] 0.40
[[$rootbone]] "bip01_pelvis"
[[$jointmerge]] "bip01_pelvis" "bip01_spine"
[[$jointmassbias]] "bip01_l_arm2" 2.00
[[$jointconstrain]] "bip01_l_arm2" x limit 0.00 0.00 0.00
[[$jointconstrain]] "bip01_l_arm2" y limit 0.00 0.00 0.00
[[$jointconstrain]] "bip01_l_arm2" z limit -120.00 4.00 0.20
[[$jointrotdamping]] "bip01_head" 5.00
[[$jointconstrain]] "bip01_head" x limit -20.00 20.00 0.00
[[$jointconstrain]] "bip01_head" y limit -25.00 25.00 0.04
[[$jointconstrain]] "bip01_head" z limit -13.00 30.00 0.04
}


==General Parameters==
{{tip|If your model has no moving parts that need to collide, use <code>[[$collisionmodel]]</code>.}}


; [[$mass]] <kilograms>
{{warning|Collision meshes should be extremely low-poly in comparison to [[body mesh]]es, and even [[lod mesh]]es. See [[collision mesh]].}}
: Manually set the mass, in kilograms, of the model.  
:* This is applicable when the object is a physics prop, rather than simply a static prop. Make certain to set this correctly, otherwise your object will behave unrealistically.  


; [[$automass]]
== Usage ==
: Automatically compute the mass of the model.
:* Derived from the density/thickness of the material defined by [[$surfaceprop]] and/or [[Prop Data|prop_data]] and the volume of the [[$collisionmodel]] itself.


; [[$masscenter]] <X Y Z offset?>
[[$collisionjoints]] <collision mesh SMD>
: Override the center of mass, in local coords.
{
 
    <options>
; [[$inertia]] <scale?>
}
: Inertia scale.
 
; [[$damping]] <scale?>
: Linear damping scale.
 
; [[$rotdamping]] <scale?>
: Rotational damping scale.
 
; [[$drag]] <scale?>
: Scales the air resistance.
 
== Joint Parameters ==
 
; [[$rootbone]] <bone_name?>
: The parent-most bone that actually has collision geometry.


; [[$jointskip]] <bone_name?>
== Options ==
: Eliminates a joint in the collision model that you don't want to use. (Rarely used.)
:* (eg: if you were using a render model as a ragdoll, and it has bones you don't want)


; [[$jointmerge]] <bone_name1> <bone_name2>
;All <code>[[$collisionmodel]]</code> options, except <code>$concave</code>
:This type of collision mesh is always concave...otherwise how could it be animated?
;$rootbone <[[string]]|bone>
:Overrides the SMD's root bone.
:{{todo|Purpose.}}
;$jointskip <[[string]]|bone>
: Eliminates a joint in the skeleton that you don't want to use in collisions.
; <code>$jointmerge <[[string]]|bone1> <[[string]]|bone2></code>
: Merges the vertex assignments for two joints.  
: Merges the vertex assignments for two joints.  
; <code>[[$jointconstrain]] <[[string]]|bone> <axis> <allow_option> <min_angle> <max_angle> <friction></code>
: Limits of the a bone's movement relative to its parent bone. See [[$jointconstrain]] for a full description.
; <code>$jointinertia <[[int]]|scale></code>
: Per-bone <code>[[$inertia]]</code>.
; <code>$jointdamping <[[int]]|scale></code>
: Per-bone <code>[[$damping]]</code>.
; <code>$jointrotdamping <[[int]]|scale></code>
: Per-bone <code>[[$rotdamping]]</code>.
; <code>$jointmassbias <[[string]]|bone> <[[float]]|bias></code>
: Mass is automatically distributed by volume, this lets you bias it per-bone.
:{{todo|Difference from a [[weightmap]].}}
; <code>$noselfcollisions</code>
: Disables collisions between bones in the same collision model for performance.
:{{warning|Results in arms clipping through torsos and other weirdness if used improperly!}}
; <code>$jointcollide <[[string]]|bone1> <[[string]]|bone2></code>
: If any <code>$jointcollide</code> pairs are specified, only those joints collide with each other.
; <code>$animatedfriction <animation_name?></code>
: Used to animate the amount of friction on joints over time.


; [[$jointconstrain]] <bone_name> <axis> <allow_option> <min_angle> <max_angle> <friction>
== Example ==
: Limits of the a bone's movement relative to its parent bone.
[[$collisionjoints]] "bip01_phys.smd"
 
{
; [[$jointinertia]] <scale?>
$mass 115.0
: Like $inertia, but per-bone.
$inertia 2.00
 
$damping 0.01
; [[$jointdamping]] <scale?>
$rotdamping 0.40
: Like $damping, but per-bone.  
$rootbone "bip01_pelvis"
 
$jointmerge "bip01_pelvis" "bip01_spine"
; [[$jointrotdamping]] <scale?>
: Like $rotdamping, but per-bone.
$jointmassbias "bip01_l_arm2" 2.00
 
$jointconstrain "bip01_l_arm2" x limit 0.00 0.00 0.00
; [[$jointmassbias]] <bone_name?> <value?>
$jointconstrain "bip01_l_arm2" y limit 0.00 0.00 0.00
: Mass is automatically distributed by volume, this lets you bias it per-bone.  
$jointconstrain "bip01_l_arm2" z limit -120.00 4.00 0.20
 
; [[$noselfcollisions]]
$jointrotdamping "bip01_head" 5.00
: Turns off all collisions between bones in this model, usually for performance.
$jointconstrain "bip01_head" x limit -20.00 20.00 0.00
$jointconstrain "bip01_head" y limit -25.00 25.00 0.04
$jointconstrain "bip01_head" z limit -13.00 30.00 0.04
}


; [[$jointcollide]] <bone_name1?> <bone_name2?>
==See also==
: If any $jointcollide pairs are specified, only those joints collide with each other.


; [[$animatedfriction]] <animation_name?>
*[[VPhysics]]
: Used to animate the amount of friction on joints over time.
*[[Physics and Ragdolls]]
*[[$collisionmodel]]


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

Revision as of 10:33, 27 April 2008

The QC command $collisionjoints is used to embed an animated and/or physically-simulated collision mesh in a model, for use in VPhysics calculations. It's most often used for ragdolls, but also works with canned animations.

Tip.pngTip:Use vcollide_wireframe 1 to view collision meshes in-game.
Tip.pngTip:If your model has no moving parts that need to collide, use $collisionmodel.
Warning.pngWarning:Collision meshes should be extremely low-poly in comparison to body meshes, and even lod meshes. See collision mesh.

Usage

$collisionjoints <collision mesh SMD>
{
    <options>
}

Options

All $collisionmodel options, except $concave
This type of collision mesh is always concave...otherwise how could it be animated?
$rootbone <string|bone>
Overrides the SMD's root bone.
Todo: Purpose.
$jointskip <string|bone>
Eliminates a joint in the skeleton that you don't want to use in collisions.
$jointmerge <string|bone1> <string|bone2>
Merges the vertex assignments for two joints.
$jointconstrain <string|bone> <axis> <allow_option> <min_angle> <max_angle> <friction>
Limits of the a bone's movement relative to its parent bone. See $jointconstrain for a full description.
$jointinertia <int|scale>
Per-bone $inertia.
$jointdamping <int|scale>
Per-bone $damping.
$jointrotdamping <int|scale>
Per-bone $rotdamping.
$jointmassbias <string|bone> <float|bias>
Mass is automatically distributed by volume, this lets you bias it per-bone.
Todo: Difference from a weightmap.
$noselfcollisions
Disables collisions between bones in the same collision model for performance.
Warning.pngWarning:Results in arms clipping through torsos and other weirdness if used improperly!
$jointcollide <string|bone1> <string|bone2>
If any $jointcollide pairs are specified, only those joints collide with each other.
$animatedfriction <animation_name?>
Used to animate the amount of friction on joints over time.

Example

$collisionjoints "bip01_phys.smd"
{
	$mass			115.0
	$inertia		2.00
	$damping		0.01
	$rotdamping		0.40
	$rootbone		"bip01_pelvis"
	$jointmerge		"bip01_pelvis"	"bip01_spine"

	$jointmassbias		"bip01_l_arm2"	2.00
	$jointconstrain		"bip01_l_arm2"	x limit	0.00 0.00 0.00
	$jointconstrain		"bip01_l_arm2"	y limit	0.00 0.00 0.00
	$jointconstrain		"bip01_l_arm2"	z limit	-120.00 4.00 0.20

	$jointrotdamping	"bip01_head"	5.00
	$jointconstrain		"bip01_head"	x limit	-20.00 20.00 0.00
	$jointconstrain		"bip01_head"	y limit	-25.00 25.00 0.04
	$jointconstrain		"bip01_head"	z limit	-13.00 30.00 0.04
}

See also