Counter-Strike 2 Workshop Tools/BreakableWindows: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 59: Line 59:


== Adding Break pieces to model ==
== Adding Break pieces to model ==
Broken glass shards are done procedurally inside of modeldoc
Broken glass shards are done procedurally inside of modeldoc, to do that:
#add '''BreakPieceEmbedded''' to model, for now it would show an error, ignore it as it would be fixed by adding child notes later.
#set the following properties:
::{| class=standard-table
!  Property Name || Value
|-
| Ragdoll Applies Bind Pose Root || no
|-
| Collision Group || Debris
|-
| Fade Time || 3
|-
| Essential Piece|| yes
|-
| Material Group Mode|| Inherit Material Index
|-
| Spawn Piece Motion Disabled|| yes
|-
| Piece Health Override|| 0
|}
 
 


== Creating custom glass material ==
== Creating custom glass material ==

Revision as of 21:51, 3 October 2024

Note.pngNote:This tutorial assumes a basic familiarity with ModelDoc Editor.
Icon-Bug.pngBug:func_breakable does not spawn gibs on break in Counter-Strike 2 Counter-Strike 2. It's recommended to use prop_dynamic instead  [todo tested in ?]
Icon-Important.pngImportant:Glass material should have dynamic expressions configured, otherwise there would be no break pieces.

example model can be found in 🖿Counter-Strike Global Offensive\content\csgo\workshop\content_examples\breakable_glass\breakable_glass_01.vmdl

model doc outliner setup for breakable glass

Making base window model

Tip.pngTip:it is not needed to have custom model file since primitive shapes are created inside of ModelDoc

Adding a root node

  • add RenderMeshFile to model, cancel the file selection and press Keep on popup , It should appear as empty node, change RenderMeshFile Name to something like "window". This would be used as root node to add modifiers as child later. It should have the following parameters in inspector:

RenderMeshFile

Property Name Value
Name window
Source file <none>

Adding box primitive

  1. add Mesh Operation Stack node as parent of RenderMeshFile
  2. add Box Primitive as child of Mesh Operation Stack , set desired `Box dimensions` (x-thickness,y-width,z-height), but keep `Position` at [0,0,0], for this example, use 🖿workshop/content_examples/breakable_glass/breakable_glass_01.vmat material
  3. add UV map planar custom stretch it so only single part of window texture fills model (you need to unselect this node and compile to preview how uv will look)
Icon-Important.pngImportant:Model should be facing forward in X+ direction.


Adding physic properties

PhysicsHullFromRender

  • add PhysicsHullFromRender with following properties:
Property Name Value
Surface Property glass
Collision Property window

prop_data

  • add prop_data with following properties:
Property Name Value
Base Prop Glass.Window
Allow As Static Prop yes
Health 1

This will make sure that the prop can be used as prop_physics

Adding Break pieces to model

Broken glass shards are done procedurally inside of modeldoc, to do that:

  1. add BreakPieceEmbedded to model, for now it would show an error, ignore it as it would be fixed by adding child notes later.
  2. set the following properties:
Property Name Value
Ragdoll Applies Bind Pose Root no
Collision Group Debris
Fade Time 3
Essential Piece yes
Material Group Mode Inherit Material Index
Spawn Piece Motion Disabled yes
Piece Health Override 0


Creating custom glass material