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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
[[File:Cs2 br glass mdoc hierarchy.png|thumb|right|250|model doc outliner setup for breakable glass]]
[[File:Cs2 br glass mdoc hierarchy.png|thumb|right|250|model doc outliner setup for breakable glass]]


== Making base window model ==
{{tip|it is not needed to have custom model file since primitive shapes are created inside of ModelDoc}}
=== Adding a root node ===


== Creating base window model ==
{{todo| unscrew that and make it more readable and consistent}}
{{tip|it is not needed to have custom model file since primitive shapes are created inside of ModelDoc}}
* add [[RenderMeshFile]] to outliner, cancel the file selection and keep the created note, It should appear as empty node, change [[RenderMeshFile]] Name to something like "window"


RenderMeshFile:
* 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:
{{Quote|;
 
:Name: window
====RenderMeshFile====
:Source file: <none>}}
 
{{KV|intn=name|Name|string|Name of the node}} = "window"
{{KV|intn=filename|Source file|string|Model to render}} = <empty>


* add [[Mesh Operation Stack]] as parent of [[RenderMeshFile]]
=== Adding box primitive ===
* 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
#add '''Mesh Operation Stack''' node as parent of '''RenderMeshFile'''
* add [[UV map planar custom]] stretch it so only single part of window texture fills model (note: you need to unselect this node and compile to preview how uv will look)
#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 {{path|workshop/content_examples/breakable_glass/breakable_glass_01|vmat}} material
{{important|Glass model should be facing forward in {{code|X+}} direction.}}
#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)


*add PhysicsHullFromRender with following properties:
*add PhysicsHullFromRender with following properties:
Line 37: Line 40:
todo
todo
== Creating custom glass material ==
== Creating custom glass material ==
todo

Revision as of 07:20, 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

Name (name) <string>
Name of the node = "window"
Source file (filename) <string>
Model to render = <empty>

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
Icon-Important.pngImportant:Glass model should be facing forward in X+ direction.
  1. 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)
  • add PhysicsHullFromRender with following properties:
Surface Property: glass
Collision Property: window
  • add prop_data with following properties:
Base Prop: Glass.Window
Allow as static prop: true
Health: 1

Adding Break pieces to model

todo

Creating custom glass material