Difference between revisions of "$collisionjoints"

From Valve Developer Community
Jump to: navigation, search
(It's not a warning it's just info.)
m (Add warning about phys_bone_follower being required for every convex section)
 
(13 intermediate revisions by 10 users not shown)
Line 1: Line 1:
The [[QC command]] <code>[[$collisionjoints]]</code> is used to define a [[jointed collision model]] for a ragdoll. A jointed collision model is used by [[VPhysics]] to detect collisions and animate the model's Skeleton accordingly. The main parameter is the name of the [[physbox.smd]] or [[ragdoll.smd]] file containing this model's skeletal and collision geometry. The [[Rigging]] parameters configure the way the skeletal joints respond to Vphysics forces. <!--It's most often used for ragdolls, but also works with canned animations. //AFAIK sequence-animating models cannot(?) use vphysics collision detection - they use IKrules and entity-defined-hulls.-->
+
{{toc-right}}
  
{{tip|Use <code>vcollide_wireframe 1</code> to view collision meshes in-game.}}
+
The [[QC command]] '''<code>$collisionjoints</code>''' is used to define a [[collision mesh]] made up of multiple independent parts, either for a [[ragdoll]] or for [[$sequence|an animated object]]. If your model has no moving parts that need to collide, use <code>[[$collisionmodel]]</code> instead.
  
{{tip|If your model has no moving parts that need to collide, use <code>[[$collisionmodel]]</code>.}}
+
A ragdoll can have up to 32 separate parts (i.e. 32 bones can be simulated, 24 on older versions of source). The limit for an animated model is 99 separate parts.
  
{{note|Collision meshes should be extremely low-poly in comparison to [[reference mesh]]es, and even [[lod mesh]]es. See [[collision mesh]].}}
+
{{tip|Use <code>vcollide_wireframe 1</code> to view collision meshes in-game.}}
 +
{{warning|Each convex part will produce a [[phys_bone_follower]] entity, potentially using up large parts of the entity count. Using this for models that are to be repeated many times isn't a good idea!}}
  
 
== Syntax ==
 
== Syntax ==
  
  [[$collisionjoints]] <collision mesh SMD>
+
  [[$collisionjoints]] <collision mesh [[Studiomdl Data|SMD]]/[[DMX|DMX]]>
 
  {
 
  {
 
     <options>
 
     <options>
Line 16: Line 17:
 
== Options ==
 
== Options ==
  
;All <code>[[$collisionmodel]]</code> options, except <code>$concave</code>
+
; All <code>[[$collisionmodel]]</code> options, ''except <code>$concave</code>''
:This type of collision mesh is always concave...otherwise how could it be animated?
+
: {{confirm|Is $masscenter allowed?}}
;$rootbone <[[string]]|bone>
+
; $concaveperjoint
:Overrides the SMD's root bone.
+
: Permit concave collision geometry for individual bones.
:{{todo|Purpose.}}
+
; $rootbone <[[string]]|bone>
;$jointskip <[[string]]|bone>
+
: Overrides the collision mesh's root bone.
: Eliminates a joint in the skeleton that you don't want to use in collisions.
+
; $jointskip <[[string]]|bone>
; <code>$jointmerge <[[string]]|bone1> <[[string]]|bone2></code>
+
: Eliminates a joint in the skeleton that you don't want to use in collisions.
: Merges the vertex assignments for two joints.  
+
; <code>$jointmerge <[[string]]|bone1> <[[string]]|bone2></code>
 +
: Merges the vertex assignments for two joints.  
 
; <code>[[$jointconstrain]] <[[string]]|bone> <axis> <allow_option> <min_angle> <max_angle> <friction></code>
 
; <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.
 
: Limits of the a bone's movement relative to its parent bone. See [[$jointconstrain]] for a full description.
Line 35: Line 37:
 
; <code>$jointmassbias <[[string]]|bone> <[[float]]|bias></code>
 
; <code>$jointmassbias <[[string]]|bone> <[[float]]|bias></code>
 
: Mass is automatically distributed by volume, this lets you bias it per-bone.
 
: Mass is automatically distributed by volume, this lets you bias it per-bone.
:{{todo|Difference from a [[$weightlist]].}}
 
 
; <code>$noselfcollisions</code>
 
; <code>$noselfcollisions</code>
 
: Disables collisions between bones in the same collision model for performance.
 
: Disables collisions between bones in the same collision model for performance.
:{{warning|Results in arms clipping through torsos and other weirdness if used improperly!}}
+
: {{warning|Results in arms clipping through torsos and other weirdness if used improperly!}}
 
; <code>$jointcollide <[[string]]|bone1> <[[string]]|bone2></code>
 
; <code>$jointcollide <[[string]]|bone1> <[[string]]|bone2></code>
 
: If any <code>$jointcollide</code> pairs are specified, only those joints collide with each other.  
 
: If any <code>$jointcollide</code> pairs are specified, only those joints collide with each other.  
; <code>$animatedfriction <[[float]]|?> <[[float]]|?> <[[float]]|?> <[[float]]|?> <[[float]]|?></code>
+
; <code>$animatedfriction <[[float]]|FrictionTimeIn> <[[float]]|FrictionTimeOut> <[[float]]|FrictionTimeHold> <[[float]]|MinAnimatedFriction> <[[float]]|MaxAnimatedFriction></code>
 
: Used to animate the amount of friction on joints over time.
 
: Used to animate the amount of friction on joints over time.
  
 
== Example ==
 
== Example ==
[[$collisionjoints]] "bip01_phys.smd"
+
 
{
+
<source lang=php>
$mass 115.0
+
$collisionjoints "bip01_phys.smd"
$inertia 2.00
+
{
$damping 0.01
+
$mass 115.0
$rotdamping 0.40
+
$inertia 2.00
$rootbone "bip01_pelvis"
+
$damping 0.01
$jointmerge "bip01_pelvis" "bip01_spine"
+
$rotdamping 0.40
+
$rootbone "bip01_pelvis"
$jointmassbias "bip01_l_arm2" 2.00
+
$jointmerge "bip01_pelvis" "bip01_spine"
$jointconstrain "bip01_l_arm2" x limit 0.00 0.00 0.00
+
 
$jointconstrain "bip01_l_arm2" y limit 0.00 0.00 0.00
+
$jointmassbias "bip01_l_arm2" 2.00
$jointconstrain "bip01_l_arm2" z limit -120.00 4.00 0.20
+
$jointconstrain "bip01_l_arm2" x limit 0.00 0.00 0.00
+
$jointconstrain "bip01_l_arm2" y limit 0.00 0.00 0.00
$jointrotdamping "bip01_head" 5.00
+
$jointconstrain "bip01_l_arm2" z limit -120.00 4.00 0.20
$jointconstrain "bip01_head" x limit -20.00 20.00 0.00
+
 
$jointconstrain "bip01_head" y limit -25.00 25.00 0.04
+
$jointrotdamping "bip01_head" 5.00
$jointconstrain "bip01_head" z limit -13.00 30.00 0.04
+
$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
 +
}
 +
</source>
  
 
== See also ==
 
== See also ==
 +
 
*[[$weightlist]]
 
*[[$weightlist]]
 
*[[VPhysics]]
 
*[[VPhysics]]

Latest revision as of 08:27, 9 September 2019

The QC command $collisionjoints is used to define a collision mesh made up of multiple independent parts, either for a ragdoll or for an animated object. If your model has no moving parts that need to collide, use $collisionmodel instead.

A ragdoll can have up to 32 separate parts (i.e. 32 bones can be simulated, 24 on older versions of source). The limit for an animated model is 99 separate parts.

Tip:Use vcollide_wireframe 1 to view collision meshes in-game.

Warning: Each convex part will produce a phys_bone_follower entity, potentially using up large parts of the entity count. Using this for models that are to be repeated many times isn't a good idea!

Syntax

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

Options

All $collisionmodel options, except $concave
Confirm:Is $masscenter allowed?
$concaveperjoint
Permit concave collision geometry for individual bones.
$rootbone <string|bone>
Overrides the collision mesh's root bone.
$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 <string|bone> <float|scale>
Per-bone $inertia.
$jointdamping <string|bone> <float|scale>
Per-bone $damping.
$jointrotdamping <string|bone> <float|scale>
Per-bone $rotdamping.
$jointmassbias <string|bone> <float|bias>
Mass is automatically distributed by volume, this lets you bias it per-bone.
$noselfcollisions
Disables collisions between bones in the same collision model for performance.
Warning: 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 <float|FrictionTimeIn> <float|FrictionTimeOut> <float|FrictionTimeHold> <float|MinAnimatedFriction> <float|MaxAnimatedFriction>
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