Difference between revisions of "Talk:Creating custom gibs"

From Valve Developer Community
Jump to: navigation, search
Line 15: Line 15:
 
: Sounds like a good plan; well worth a try. For syntax see [[$collisiontext]]. If it works please add a note of your observations to that page ;-)--[[User:Beeswax|Beeswax]] 08:01, 23 May 2008 (PDT)
 
: Sounds like a good plan; well worth a try. For syntax see [[$collisiontext]]. If it works please add a note of your observations to that page ;-)--[[User:Beeswax|Beeswax]] 08:01, 23 May 2008 (PDT)
 
::Followup: I didn't get anything with burst, but I did use $origin x y z rotationZ to manually place the pieces. I get the feeling that I'm not going to get so much a physics based arc-and-fall as just a model swap. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)
 
::Followup: I didn't get anything with burst, but I did use $origin x y z rotationZ to manually place the pieces. I get the feeling that I'm not going to get so much a physics based arc-and-fall as just a model swap. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)
 +
::: What happens if you zap it with the gravgun rather than just worrying it with the crowbar? I suppose you could try setting a small explosive charge in your [[Propdata#Exploding_props]] ? I've a suspicion that propdata has more influence over custom gibs than the docs currently suggest. Another thought is if you place 2 phys props too close together, they "jump" apart at when the map spawns ... perhaps if you butt-up or even overlap the gibs a bit they might  do the same? --[[User:Beeswax|Beeswax]] 12:12, 23 May 2008 (PDT)
  
 
2) Only one instance of each gib is spawning, how could I spawn multiples of types A&B while still keeping C&D unique?
 
2) Only one instance of each gib is spawning, how could I spawn multiples of types A&B while still keeping C&D unique?
Line 20: Line 21:
 
: I guess if you just repeated your <code>break {"model" "gibs/gibA" ...}</code> line in the [[$collisiontext]] you'll get two gibA's spawning in the same place... you might get away with that. Otherwise you might try the $collisiontext "offset" parameter on one of them ? (probably XYZ coords from either model $origin or the gib.mdl's position). Again, if it works please share ;-) --[[User:Beeswax|Beeswax]] 08:01, 23 May 2008 (PDT)
 
: I guess if you just repeated your <code>break {"model" "gibs/gibA" ...}</code> line in the [[$collisiontext]] you'll get two gibA's spawning in the same place... you might get away with that. Otherwise you might try the $collisiontext "offset" parameter on one of them ? (probably XYZ coords from either model $origin or the gib.mdl's position). Again, if it works please share ;-) --[[User:Beeswax|Beeswax]] 08:01, 23 May 2008 (PDT)
 
::Followup: The break{"model"} didn't appear to work, but it could be spawning 2 instances in the exact same place. One solution is to clone the files of gibA and make it gibE (and gibF, gibG and so on) with different $origin x y z rotationZ values, but it's clunky. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)
 
::Followup: The break{"model"} didn't appear to work, but it could be spawning 2 instances in the exact same place. One solution is to clone the files of gibA and make it gibE (and gibF, gibG and so on) with different $origin x y z rotationZ values, but it's clunky. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)
 +
::: You might also need a [[game_gib_manager]]. Did you try the [[$autocenter]] trick - in XSI (etc) arrange the gib models in their starting positions, export them individually and then add $autocenter to the qc for each gib ? ... that should be easier than manually offsetting the $origin and save you some problems with lighting origins etc. It might help with the physics problem too (though I can't see how ...) Did you try the $collisiontext "offset" command ? eg
 +
    $collisiontext
 +
    {
 +
    break { "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15" "offset" "0 0 0"}
 +
    break { "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15" "offset" "10 10 10"}
 +
    break { "model" "trashcan/trashcan_piece_b.mdl" "fadetime" "15" "offset" "0 0 0"}
 +
  // etc ...
 +
 +
--[[User:Beeswax|Beeswax]] 12:12, 23 May 2008 (PDT)
  
 
Here are my .qc files- I would have posted them earlier but I had a problem with the spawned gibs allowing further breaking into generic HL2 bits on hit. Now fixed, although the gibs don't respect their collisions and so allow the player to frollic through the models.
 
Here are my .qc files- I would have posted them earlier but I had a problem with the spawned gibs allowing further breaking into generic HL2 bits on hit. Now fixed, although the gibs don't respect their collisions and so allow the player to frollic through the models.
 +
: gibs are funny beasties when it comes to physics. AFAIK most gibs are generally not Solid by default - akin to prop_details. Check out the physicsmode in [[Propdata#General]]. Also, which game are you testing with - single player of multiplayer ? --[[User:Beeswax|Beeswax]] 12:12, 23 May 2008 (PDT)
 +
  
 
Breakable Object .QC:
 
Breakable Object .QC:
Line 53: Line 65:
 
     $modelname trashcan\trashcan_piece_a.mdl
 
     $modelname trashcan\trashcan_piece_a.mdl
 
     $keyvalues { "prop_data" { "base" "Wooden.Small" "health" "0" } }
 
     $keyvalues { "prop_data" { "base" "Wooden.Small" "health" "0" } }
     //Health 0 makes it invulnerable. Not having this or setting it to another value allows the gib to be busted into more gibs. Small wood bits, in this case.  
+
     // Health 0 makes it invulnerable. Not having this or setting it to another value allows the gib to be busted into more gibs. Small wood bits, in this case.  
 
     $body studio "trashcan_piece_a"
 
     $body studio "trashcan_piece_a"
 
     $cdmaterials models\trashcan
 
     $cdmaterials models\trashcan
 
     $staticprop
 
     $staticprop
 
     $surfaceprop "wood"
 
     $surfaceprop "wood"
     //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
+
     // Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
 
     $sequence idle "trashcan_piece_a" loop fps 15
 
     $sequence idle "trashcan_piece_a" loop fps 15
 
     $origin -24.043 -24.066 2.166 0
 
     $origin -24.043 -24.066 2.166 0
     // values are X Y Z rotationZ, without they will spawn in one large heap if their origins are the same. If the objects are exported at non-origin values they would spawn there, unless this is called.
+
     // Values are X Y Z rotationZ, without they will spawn in one large heap if their origins are the same. If the objects are exported at non-origin values they would spawn there, unless this is called.
 
     $collisionmodel "trashcan_piece_a_collision.SMD"
 
     $collisionmodel "trashcan_piece_a_collision.SMD"
     //This is not being respected, while hitting the object with a weapon such as a crowbar results in movement and seems to use the collision, the object is able to be walked through.
+
     // This is not being respected, while hitting the object with a weapon such as a crowbar results in movement and seems to use the collision, the object is able to be walked through.
 
     {
 
     {
 
     $automass
 
     $automass
 
     }
 
     }
 
Also posting this on the main page, now that I've figured out how to use the quote/code border. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)
 
Also posting this on the main page, now that I've figured out how to use the quote/code border. --[[User:Rayne|Rayne]] 10:41, 23 May 2008 (PDT)

Revision as of 19:12, 23 May 2008

I'm not having much luck getting my gibs to work. The models are valid and can be spawned directly, but won't appear when the prop is destroyed. The QC:

$collisiontext
{
	break { model "props_escape/plate_gibs-small" placementattachment placementOrigin health 1 fadetime 0 }
	break { model "props_escape/plate_gibs-big" placementattachment placementOrigin health 1 fadetime 0 }
}

It's nothing to do with the lack of quote marks. :-) --TomEdwards 10:06, 19 Nov 2007 (PST)

I have no idea what I did, but it's now working. --TomEdwards 13:18, 19 Nov 2007 (PST)
You're talking to yourself mate. ;-) (Keep us posted) --wisemx 15:57, 19 Nov 2007 (PST)

1) I am looking to give my gibs more spread, currently they spawn in one heap where the original object is. Would burst give them a larger range, and how would I call it? (burst "5" ?) --Rayne 13:38, 21 May 2008 (PDT)

Sounds like a good plan; well worth a try. For syntax see $collisiontext. If it works please add a note of your observations to that page ;-)--Beeswax 08:01, 23 May 2008 (PDT)
Followup: I didn't get anything with burst, but I did use $origin x y z rotationZ to manually place the pieces. I get the feeling that I'm not going to get so much a physics based arc-and-fall as just a model swap. --Rayne 10:41, 23 May 2008 (PDT)
What happens if you zap it with the gravgun rather than just worrying it with the crowbar? I suppose you could try setting a small explosive charge in your Propdata#Exploding_props ? I've a suspicion that propdata has more influence over custom gibs than the docs currently suggest. Another thought is if you place 2 phys props too close together, they "jump" apart at when the map spawns ... perhaps if you butt-up or even overlap the gibs a bit they might do the same? --Beeswax 12:12, 23 May 2008 (PDT)

2) Only one instance of each gib is spawning, how could I spawn multiples of types A&B while still keeping C&D unique? --Rayne 13:38, 21 May 2008 (PDT)

I guess if you just repeated your break {"model" "gibs/gibA" ...} line in the $collisiontext you'll get two gibA's spawning in the same place... you might get away with that. Otherwise you might try the $collisiontext "offset" parameter on one of them ? (probably XYZ coords from either model $origin or the gib.mdl's position). Again, if it works please share ;-) --Beeswax 08:01, 23 May 2008 (PDT)
Followup: The break{"model"} didn't appear to work, but it could be spawning 2 instances in the exact same place. One solution is to clone the files of gibA and make it gibE (and gibF, gibG and so on) with different $origin x y z rotationZ values, but it's clunky. --Rayne 10:41, 23 May 2008 (PDT)
You might also need a game_gib_manager. Did you try the $autocenter trick - in XSI (etc) arrange the gib models in their starting positions, export them individually and then add $autocenter to the qc for each gib ? ... that should be easier than manually offsetting the $origin and save you some problems with lighting origins etc. It might help with the physics problem too (though I can't see how ...) Did you try the $collisiontext "offset" command ? eg
    $collisiontext
   {
   break { "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15" "offset" "0 0 0"}
   break { "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15" "offset" "10 10 10"}
   break { "model" "trashcan/trashcan_piece_b.mdl" "fadetime" "15" "offset" "0 0 0"}
  // etc ...

--Beeswax 12:12, 23 May 2008 (PDT)

Here are my .qc files- I would have posted them earlier but I had a problem with the spawned gibs allowing further breaking into generic HL2 bits on hit. Now fixed, although the gibs don't respect their collisions and so allow the player to frollic through the models.

gibs are funny beasties when it comes to physics. AFAIK most gibs are generally not Solid by default - akin to prop_details. Check out the physicsmode in Propdata#General. Also, which game are you testing with - single player of multiplayer ? --Beeswax 12:12, 23 May 2008 (PDT)


Breakable Object .QC:

   $scale 1.0
   $modelname trashcan\trashcan_breakable.mdl
   $body "Body" "trashcan.smd"
   $cdmaterials models\trashcan
   $surfaceprop "wood"
   //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
   $sequence idle "trashcan" loop fps 15
   $keyvalues { "prop_data" { "base" "Wooden.Medium" "health" "10"} }
   //Health is the damage required to break the item, 0 will make it invincible.
   $collisiontext
   {
   break
       {
           "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15"
       }
   break
       {
           "model" "trashcan/trashcan_piece_b.mdl" "fadetime" "15"
       }
   }
   $collisionmodel "trashcan_collision.SMD"  {
   $concave
   $mass 100.000
   }

Custom Gib .QC:

   $scale 1.0
   $modelname trashcan\trashcan_piece_a.mdl
   $keyvalues { "prop_data" { "base" "Wooden.Small" "health" "0" } }
   // Health 0 makes it invulnerable. Not having this or setting it to another value allows the gib to be busted into more gibs. Small wood bits, in this case. 
   $body studio "trashcan_piece_a"
   $cdmaterials models\trashcan
   $staticprop
   $surfaceprop "wood"
   // Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. Seems obvious, but held me up for a day since two of my items were actually metal, and listed as such.
   $sequence idle "trashcan_piece_a" loop fps 15
   $origin -24.043 -24.066 2.166 0
   // Values are X Y Z rotationZ, without they will spawn in one large heap if their origins are the same. If the objects are exported at non-origin values they would spawn there, unless this is called.
   $collisionmodel "trashcan_piece_a_collision.SMD"
   // This is not being respected, while hitting the object with a weapon such as a crowbar results in movement and seems to use the collision, the object is able to be walked through.
   {
   $automass
   }

Also posting this on the main page, now that I've figured out how to use the quote/code border. --Rayne 10:41, 23 May 2008 (PDT)