Breakable Props
{{subst:#if:|||
Important step for replacing wikilinks after you've created this page
After you click 'Edit' do what the image shows. If you can't see editing toolbar you need to enable it in 'Preferences' -> Editing -> checkbox 'Enable the editing toolbar'
См. также:  {{LAuto}}
 
 | 
--- DON'T JUST BLINDLY DELETE THIS PART. DO REPLACE THE LINKS AND CATEGORIES. THE PICTURE SHOWS HOW TO USE IT ! ---
SEARCH FOR: \[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]
REPLACE WITH: {{subst:LAuto|$1$2}}
}}As a courtesy, please do not edit this while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.
The person who added this notice will be listed in its edit history should you wish to contact them.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)
Create a Physics Prop
Start by creating a simple box physics prop out of primitives.
This tutorial uses primitive shapes for rendering and physics, but references to mesh files (.fbx, .dmx) can be directly substituted. Import filters make it easy to create a single FBX file that contains many mesh parts that can then be referenced by separate breakpieces.
- Add RenderPrimitiveBox and PhysicsShapeBox nodes with origin (0,0,8) and dimensions (16,16,16)
 
- Apply the 'prop.wood_box' surface property to the physics box
 
- Add a prop_data node to indicate that this model is intended to be used as a physics prop.
 - Now use the ModelDoc game preview to verify that you can spawn the model as a prop_physics and move it around
 
Add a BreakPiece
- First edit the prop_data to specify a health - this will allow the prop to take damage and break if it has any breakpices:
 
- Add a BreakPieceEmbedded node - this node will contain everything required to have a simple breakpiece without authoring it as a separate model.
 - Under the BreakPieceEmbedded node, add a RenderPrimitiveBox and PhysicsShapeBox with origin (0,4,8) and dimension (15,7,15) - you can do this by copy-pasting the boxes you created earlier.
 - For clarity assign the renderbox the primary_red.vmat material so it's very clear when the object breaks.
 
Each BreakPieceEmbedded node is effectively a small embedded sub-document that can contain most nodes. (NOTE: Due to a limitation in the editor it may warn about some nodes but most will work just fine.) When the parent model compiles, each BreakPieceEmbedded will be extracted and compiled into a separate vmdl_c that is then referenced by the parent model's break info.
Add a Second BreakPiece
Breaking something isn't very interesting if it only breaks into a single piece. Right-click your BreakPiece and select "duplicate" then change the origin of the new boxes to (0,-4,8)
We made breakpieces slightly smaller than the original box in order to guarantee that they don't overlap when they're spawned. The physics engine is fairly resilient in the face of overlapping objects, but it's always better to avoid when possible!
Test Your Breakable
Use the game preview to spawn a prop_physics and use the shoot tool to verify that it takes damage and breaks as expected. Congratulations, you've made your first breakable model!




