Эта статья относится к игре "Half-Life: Alyx". Нажмите для получения дополнительной информации.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Breakable Props

From Valve Developer Community
< Ru‎ | Half-Life: Alyx Workshop Tools‎ | Modeling
Revision as of 05:23, 13 February 2025 by Trektra (talk | contribs) (Created page with "{{subst:#if: Translation of 'Half-Life: Alyx Workshop Tools/Modeling/Breakable Props' to 'русский' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{{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'

Preload - Language Links Replace.jpg
См. также:  {{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}}

}}
Under construction.png
This page is actively undergoing a major edit.
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.

Info content.png
This page needs to be translated.
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)

English (en)Русский (ru)Translate (Translate)
Note.pngПримечание:This tutorial assumes a basic familiarity with ModelDoc usage as established by the earlier tutorials.

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)

Breakable Props-132120844.png


  • Apply the 'prop.wood_box' surface property to the physics box

Breakable Props-132120843.png


  • 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

Breakable Props-132120848.png

Breakable Props-132120850.gif

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:

Breakable Props-132120852.png

  • 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.

Breakable Props-132120862.png

Breakable Props-132120864.png

Breakable Props-132120865.png

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)

Breakable Props-132120863.png

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!

Breakable Props-132120867.gif