Is there a way to "destroy" props? (Please read to understand what I mean)

Started by Filipe23, May 27, 2015, 03:01:32 PM

Previous topic - Next topic

Filipe23

Hi,
First, I'd like to congratulate the author for the Wall Worm tools, I use these to export my props from 3ds Max to Hammer, I learned to create static/physics props and even use multiple skins, it's a really cool plugin.

However, I'm curious to know if it's possible at all to to this... When you use Hammer editor, there's a mug prop "coffee_mug.mdl"
This is a single 3d model, but when you play the game, if you shoot at this mug, this model is replaced with a different 3d model of a broken mug (It's NOT the same model breaking itself, it's a different model)

It's not the only object that does this, there are more...

I'd like to know if this is possible to do with my model (I made a laptop, and I would like to replace this model with a damaged version of my laptop, after shooting at it of course)

Could someone tell me how to do this, or at least point me in the right direction? (like, tell me if there's a specific name for this process, so I can look for it on google....)

Thank you!

Joris Ceoen

Do you mean that it breaks, in that the texture switches to a broken screen or something? Or do you mean actual parts flying off? There is in both cases a perfect process to do this in WW and both relate to the prop_physics (where the gibs (chuncks that fly off as being broken), the mass and other settings are stored in so that you'll only have to select it as prop_physics or prop_physics_multiplayer and it will do the rest.

I have done this before, and I cannot recall the process (I can but I cannot recall it correctly to write it down off my head right now). I will try to make a simple model and then explain you the steps on how to do this. In the future I will also make a video demonstrating this as part of the tutorials I'm preparing for WWMT.

Filipe23

Quote from: Joris Ceoen on May 27, 2015, 03:25:18 PM
Do you mean that it breaks, in that the texture switches to a broken screen or something? Or do you mean actual parts flying off?

Thank you for your answer,

To clarify, I believe the game actually replaces the original mug model with a new model of a broken mug

In Hammer Editor, when you create a prop_physics_multiplayer, on "World model" you can search for "coffee_mug" and you'll find some models: "coffee_mug.mdl" and there are some other models called "coffee_mug_p1.mdl" "coffee_mug_p2.mdl" and "coffee_mug_p3.mdl" (these last 3 models are broken pieces of the mug)

If you place "coffee_mug.mdl" in your level, and shoot it, this model basically disappears and gets replaced by the other 3 models (the model itself wont break)


Joris Ceoen

Ok, thanks for clarifying. That's basically the second option with gibs. The quick idea of this is that you create your model, then make a copy of that one and break it down in multiple parts if you want, then you can select those parts and turn them all into a gib which can quickly be done with WW. This can be a one-way step where the prop you make breaks only once, but you can also make a broken version of a prop and then make THAT broken prop collapse into even more parts etc (like the computer model in CS:S or CS:GO where it takes like 8 shots to empty the computer of all its parts).

Tomorrow in the morning I will sit to it right away to explain this to you in detail. That or Shawn is earlier than me and is willing to explain all of this (but I will do it in the morning guaranteed if he hasn't replied by then). In any event, it's really not as complicated as it sounds.

Filipe23

Ah ok, I wasn't sure if I had explained myself properly (And wasn't sure we where talking about the same thing  :P )

I really appreciate the fact that you'll give me an explanation tomorrow, I wasn't expecting that :)

This is one of those things I really couldn't figure out how to achieve, and it's difficult to find any relevant results on google when I don't even know the correct names of these functions and don't know what to search for

Thank you!

Joris Ceoen

For now I'm preparing a little scene (but I'm having unexpected trouble and still finding out) but here is the page that actually explains all of this with a video inclusive (for some reason I googled this but it didn't show up so I only got to find it today): http://dev.wallworm.com/topic/28/prop_data_and_custom_gibs.html

Joris Ceoen

Well basically, the video above explains it all. I now succeeded into making a breakable prop again.

So what you do is, if you have a model that's completely finished (it's highly recommended you make SURE it's final, that it won't undergo more tweaks later on) you want to assign it a WWMT Helper which can be done with the Wall Worm Model Tools (which can be accessed from the rollout, the first one in the Wall Worm tab of 3DS Max).

Once you have done that, you can now create a copy of your model and from this point on you have a few options:

  • You sew it up in multiple pieces by the use of slice modifiers or manual editting. Each sawed part must be turned into a seperate OBJECT (not element!)
  • You detach multiple parts from the model as seperate objects and edit them up so there are no holes to be seen in it (with holes I mean faces from which the backside can be seen which is invisible in Source)
  • Any other method you prefer

Alternatively but not necessary, if you want each gib to have its pivot point at the center as opposed to all having their pivot point to the original model, just select all of the gibs (the objects), hit the Hierarchy tab, select Affect Pivot Only -> Center To Object -> Reset Transform and Scale. THEN go to the Utilities tab, hit Reset Xform and convert all the objects to Editeable Polygons again.

Once you have all the gibs you need, you now go back to your original WWMT Helper and in the WW rollout, you can find the 'Collision Model & Physics' rollout.
Unless you're willing to make your own collision model, we're going to do this with the 'Quick Hull' option. Right above you'll find a number next to 'Max Verts Hulls' which will by default be 44. Depending on the complexity of your model, this might be increased or decreased, but because this number represents the total amount PER piece, it should generally be lower, like 20-30. It can also create multiple parts by which it will automatically be assigned the $concave option.

EXTREMELY IMPORTANT right now is to make sure you also assign it a mass. Click the Overrides checkbox and assign any number higher than 10 or something to the mass. Lower than 10 will often make your object almost fly as if being too light. Depending on the size, it can range from 20-500 or more (usually objects that heavy around the number 500 are static anyways). If you do not assign a mass, your object will behave extremely odd and sometimes will simply not spawn.


Once you have done either of both collision methods (don't forget that if you're making your own collision model, each and every piece must be convex. If there is more than 1 piece, you must assign it the $concave tag!) you can now go to the 'Prop Data and Custom Gibs' rollout. From here, follow these steps:

  • In the gibs model class section in the gibs box, select CustomGibs
  • Select all of your Gib Objects (the ones you made from the copy of your original model) and hit 'Add Sel Gibs'. This will now create a bunch of new WWMT helpers.
  • Select ALL of these new WWMT helpers (not any other ones!) and open up the Hull Helper (Which can be found in the Wall Worm Model Tools menu, right under the button with the same name (the second one)). Repeat the above step by setting the Max Verts Hulls to something like 25 and hit Quick Hulls. This will automatically assign a collision model to each gib chunk and make sure that the settings are all correctly placed.
  • EXTREMELY IMPORTANT: This part is not shown in the video, but it's vital that you manually assign a mass value to each gib chunk because they are 0 by default.
  • Finally, select a Base physics class that matches the material type from your model.

However, you may also want to enable the 'Override Base Phys Settings' in order to assign it a health value that you deem realistic. If you do so, you are also obliged to assign a dmg.bullet value higher than 0, otherwise bullets will deal no damage to the prop and it will just remain a simple prop_physics that cannot break. The reason why I mention this is because not every Base Class for prop_physics has the ability to generate gibs (or custom gibs if you made them).

I hope this was clear enough. The video should provide enough visual assistence along with this explanation (or with the explanation on the Prop Data information link). If you have any questions, feel free to reply to this post!

wallworm

Great write up Joris.

Until I get around to making updates to the code for making the gibs mass overrides from parent WWMT which would take some calculations that require info I just don't have (like the actual mass values of each base type), you can use these MAXScript snippets.

Select the WWMT Helpers you want to set the values to and paste these lines into the MAXScript listener and hit ENTER:

Turn On the Physics Overrides
for obj in selection where isProperty obj #Wallworm_Model_Tools do obj.usePhysOverrides = on

Turn On the Physics Automass
for obj in selection where isProperty obj #Wallworm_Model_Tools do obj.automass = on

or set the mass:

Set the Mass
for obj in selection where isProperty obj #Wallworm_Model_Tools do obj.mass = 100

Now you can change the values of multiple all at once.

Another hint is that for gibs models, you may find they are placed more realistically if they share the same pivot as the parent WWMT node.

Filipe23

I want to thank you both for your help! I spent the last hours trying various experiments (I re-exported my model/QC files like a million times and I finally I got the desired results :P)

I couldn't find that video either, but because I had no idea of the meaning of the word "gibs" (I'm not english) so I never realized that's what I was supposed to look for... (I googled "debris" and other synonyms but no luck...) But fortunately I now understand how this works.

I had some trouble with mass/inertia properties but I finally got a decent balance to make my laptop "feel" like a laptop :P

Quote from: wallworm on May 28, 2015, 09:10:22 AM
Turn On the Physics Overrides
for obj in selection where isProperty obj #Wallworm_Model_Tools do obj.usePhysOverrides = on

I did notice the Gibs get the same "physics" as the original prop and wondered if that could be fixed, I didn't try these scripts yet but I'll try them soon, thank you! (Yes, I'm still re-exporting things because I'm spending countless hours with small details (as always...   ;D )

Here are some pictures of what happens before and after shooting my model (I only need to shoot once, and that's what I wanted):
Also you might wonder why didn't I break my computer in parts... I plan to do that after the second shot, the first shot is supposed to damage the computer but not break it apart, right know, However it's doing what I want, I'm able to replace the original laptop with this modified version (the laptop screen lid is more "open", and I gave it a different texture)

If you notice the picture, you can even see I'm using self-illumination on the screen, even after shooting the computer, to make it look like the screen is damaged but the computer is still barely working, so the screen still gets light, but no picture (I've seen screens doing this effect before)
Once again, thank you very much for the detailed help!

wallworm

Excellent :)

I also need to mention an undocumented utility for gibs.

If you select the parent WWMT Helper, you can open the WWMT in the modify tab of the command panel. If you scroll down to the Prop Data & Gibs rollout in the modify tab, you'll see a button at the bottom labeled "Send Phys Overrides to Gibs" . I added this to the WWMT Helpers but never got around to adding it to the WWMT Floater (mainly because the WWMT Floater UI is one of the oldest, ugliest, scariest parts of WW code... and I'm loathe to touch it :) )

So what you can do in the parent is set all the phys override settings for the children, click the Send Phys Override to Gibs button (to update the gibs) then change the parent back to whatever it should be.

Filipe23

Thank you for the hint! (I actually like to see WWMT inside the modify tab... It feels like this plugin is actually part of 3DS max :P)

There's just one more thing I'm trying to achieve.

As I said in the last post, I shoot the computer once, and the original model is replaced by a single gib (basically a copy of the original model, with the screen lid slightly open and a new texture) AND the screen is broken but its still bright...

Now, I'd like to be able to shoot this gib, so I get 2 smaller gibs (The screen and the keyboard in separate objects) but of course, this time with a different version of the texture, the screen is NOT supposed to be "working" anymore (So, no more self illumination for this texture, the screen should be dark like the rest of the computer.)
Yes, I watched the video, I understand how it works. I can do this, I've already exported these gibs as separate objects. and the screen is now dark (You can check the attachment below)

My only problem is... I don't know how to to this in the right order, because I shoot my computer just once, and It spawns all the gibs at the same time (The first gib, wich is the computer with the screen broken but still working, and the other 2 gibs, the keyboard and the screen in separate objects)
I know it's mentioned on the video, I can "nest" gibs to other gibs, but I don't really understand how to do that properly.
Is there another video or page explaining how to do that? (I can't find any at the moment)

Thank you very much!

(Let me know if my explanation is messed up :P )

Joris Ceoen

It's very easy to achieve what you want.

So you already have made the first part, where you will get a new gib which is the broken version with the broken texture. THAT broken laptop is the gib of the original model, BUT you can assign new gibs to that gib itself.

So basically now you repeat the same process on the gib, where you copy your gib model and seperate both pieces from it, then go to the Physics Data and Gibs part in that model and assign the 2 new pieces as gibs from the gib model. Theoretically, you could go on forever this way.

You can even do crazy stuff (which I only recommend doing for fun and not actually use this kind of thing in a map) like shooting a model and tell it to respawn 2 'gibs' that are the original model itself, so you actually spawn more and more and more of your models (until your computer crashes if you wish so xD).

Filipe23

Quote from: Joris Ceoen on May 29, 2015, 08:17:41 AM
you repeat the same process on the gib

So it's exactly the same thing... I tough it would be a different process for gibs...

Thank you again! :)

SMF spam blocked by CleanTalk