This article's documentation is for anything that uses the Source engine. Click here for more information.

$collisiontext: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(61 intermediate revisions by 13 users not shown)
Line 1: Line 1:
<div style="float:right;padding:0 1em;background:#FFF;">__TOC__</div>
{{LanguageBar}}
{{stub}}[[Category: QC Commands]]
{{this is a|QC command|name=$collisiontext}} It defines [[custom gibs]] for a breakable model. Generic gibs are instead defined by [[Prop Data#Gibs|$keyvalues > prop_data > breakable_model]].


The [[$collisiontext]] [[QC command]] is used to define a breakable model's ''custom gibset'' (''generic'' gibs are defined by [[Prop Data#Gibs|$keyvalues - prop_data - breakable_model]]).
{{tip|Use [[$autocenter]] when compiling custom gibs to fix potential lighting oddities such as the gib randomly turning pitch black while rotating/moving around.}}
{{tip|Make sure your parent model and gib have the same amount of skins since gibs inherit it. So as long as the parent model and the gib model have the same amount of skins defined, the gibs will spawn using the same skin.}}
{{bug|tested={{Source 2013 SP}}|DO NOT use backslashes in the model path. It will cause the physics of the gibs to not be restored when loading a save. Use forward slashes only.}}


{{tip|Use [[$autocenter]] to ensure gibs spawn in the correct position relative to the breaking model.}}
== Examples ==


* {{todo| is [[propdata]] also required when using $collisiontext ?}}
$collisiontext
{
break { model mycustomgib1 health 0 }
break { ragdoll mycustomgib2 health 25 fadetime 15 debris 1 burst 300 }
break { model mycustomgib3 health 10 fadetime 30 fademindist 20 fademaxdist 30 }
break { model mycustomgib4 health 10 fadetime 20 offset -2 3.68 12.4 }
}


== QC syntax example ==
  $collisiontext
  [[$collisiontext]]
  {  
  {  
  break { [[#model|"model"]] "mycustomgib1" [[#health|"health"]] "1" [[#fadetime|"fadetime"]] "0" }  
  break
  break { "model" "mycustomgib2" "health" "1" "fadetime" "0" }  
{
"model" "mycustomgib1"
"health" "0"
}
break
{
"ragdoll" "mycustomgib2"
"health" "25"
"fadetime" "15"
"debris" "1"
"burst" "300"
}
break
{
"model" "mycustomgib3"
"health" "10"
"fadetime" "30"
"fademindist" "20"
"fademaxdist" "30"
}
  break
{
"model" "mycustomgib4"
"health" "10"
"fadetime" "20"
"offset" "-2 3.68 12.4"
}
  }
  }


==break options==
== Options ==
===model===
 
* specifies the name of the .mdl to use as a gib.
; <tt>model <path/name></tt>
===ragdoll===
: The (compiled) model path to spawn as a gib. Make sure the model used as a gib is properly setup to work as a physics prop. File extension can be omitted.
* {{todo|'''guess''': specifies the name of a ragdoll model to break into, eg when zombies get cut in half ?}}
; <tt>ragdoll <path/name></tt>
===offset===
: The (compiled) model path to spawn as a ragdoll.
===health===
; <tt>offset <[[Vector]]></tt>
* {{todo|compared to [[propdata]] health ?}}
: Offsets the current gib. Values are in [[unit]]s.
===fadetime===
; <tt>health <[[float]]></tt>
===fademindist===
: Overrides the model's own health value "This sometimes has to be placed in the [[$keyvalues]] line."
===fademaxdist===
; <tt>fadetime <[[float]]|seconds></tt>
===debris===
: Time before gibs start to fade away. They are removed once the fade is complete. Setting this will also set the gib to not collide with dynamic objects (however it can be overriden by <code>debris</code> option).
===burst===
; <tt>fademindist <[[float]]|units></tt>
===placementbone===
: Distance from the camera at which to start rendering the gib.
* {{todo|compared to [[$autocenter]] ?}}
; <tt>fademaxdist <[[float]]|units></tt>
===placementattachment===
: Distance from the camera at which to stop rendering the gib.
* {{todo|compared to [[$autocenter]] ?}}
; <tt>debris <[[bool]]></tt>
: Prevents the gib model from colliding with dynamic objects when made true. It is strongly recommended to be enabled for any small gibs.
; <tt>burst <[[float]]></tt>
: Adds force, in units per second, to the gib, pushing it outward when the parent model breaks. This is useful if you want to make gibs go flying further away from the origin. Not defining this can lead into gibs simply falling flat to the ground. If <code>$autocenter</code> wasn't used, it will apply the force from the center of the gib piece instead of the parent model's origin.
; <tt>placementbone <bone></tt>
: If set to a bone name, it will spawn the gib at the bone's origin.
; <tt>placementattachment <attachment></tt>
: If set to an attachment name, it will spawn the gib at the attachment's position.
; <tt>motiondisabled <bool></tt>
: Disables all movement, motion, of the gib if enabled.
; <tt>multiplayer_break <[[string]]></tt>
: If set to <code>server</code>, the gib will not be spawned by the client. If set to <tt>client</tt>, the gib will not be spawned by the server. By default, both paths are allowed.
; <tt>velocity <[[Vector]]></tt>
: Applies velocity to the gib. The default value is <code>0 0 0</code> (no velocity).
 
== See also ==
 
* [[Prop Data#Gibs]]

Latest revision as of 21:25, 16 July 2025

English (en)Translate (Translate)

$collisiontext is a QC command available in all Source Source games. It defines custom gibs for a breakable model. Generic gibs are instead defined by $keyvalues > prop_data > breakable_model.

Tip.pngTip:Use $autocenter when compiling custom gibs to fix potential lighting oddities such as the gib randomly turning pitch black while rotating/moving around.
Tip.pngTip:Make sure your parent model and gib have the same amount of skins since gibs inherit it. So as long as the parent model and the gib model have the same amount of skins defined, the gibs will spawn using the same skin.
Icon-Bug.pngBug:DO NOT use backslashes in the model path. It will cause the physics of the gibs to not be restored when loading a save. Use forward slashes only.  (tested in: Source 2013 Singleplayer)

Examples

$collisiontext
{ 
	break { model	mycustomgib1	health 0 }
	break { ragdoll	mycustomgib2	health 25	fadetime 15	debris 1	burst 300 }
	break { model	mycustomgib3	health 10	fadetime 30	fademindist 20	fademaxdist 30 }
	break { model	mycustomgib4	health 10	fadetime 20	offset -2 3.68 12.4 }
}
$collisiontext
{ 
	break
	{
		"model"	"mycustomgib1"
		"health" "0"
	}

	break
	{
		"ragdoll" "mycustomgib2"
		"health" "25"
		"fadetime" "15"
		"debris" "1"
		"burst" "300"
	}

	break
	{
		"model"	"mycustomgib3"
		"health" "10"
		"fadetime" "30"
		"fademindist" "20"
		"fademaxdist" "30"
	}

	break
	{
		"model"	"mycustomgib4"
		"health" "10"
		"fadetime" "20"
		"offset" "-2 3.68 12.4"
	}
}

Options

model <path/name>
The (compiled) model path to spawn as a gib. Make sure the model used as a gib is properly setup to work as a physics prop. File extension can be omitted.
ragdoll <path/name>
The (compiled) model path to spawn as a ragdoll.
offset <Vector>
Offsets the current gib. Values are in units.
health <float>
Overrides the model's own health value "This sometimes has to be placed in the $keyvalues line."
fadetime <float|seconds>
Time before gibs start to fade away. They are removed once the fade is complete. Setting this will also set the gib to not collide with dynamic objects (however it can be overriden by debris option).
fademindist <float|units>
Distance from the camera at which to start rendering the gib.
fademaxdist <float|units>
Distance from the camera at which to stop rendering the gib.
debris <bool>
Prevents the gib model from colliding with dynamic objects when made true. It is strongly recommended to be enabled for any small gibs.
burst <float>
Adds force, in units per second, to the gib, pushing it outward when the parent model breaks. This is useful if you want to make gibs go flying further away from the origin. Not defining this can lead into gibs simply falling flat to the ground. If $autocenter wasn't used, it will apply the force from the center of the gib piece instead of the parent model's origin.
placementbone <bone>
If set to a bone name, it will spawn the gib at the bone's origin.
placementattachment <attachment>
If set to an attachment name, it will spawn the gib at the attachment's position.
motiondisabled <bool>
Disables all movement, motion, of the gib if enabled.
multiplayer_break <string>
If set to server, the gib will not be spawned by the client. If set to client, the gib will not be spawned by the server. By default, both paths are allowed.
velocity <Vector>
Applies velocity to the gib. The default value is 0 0 0 (no velocity).

See also