This article's documentation is for anything that uses the Source engine. Click here for more information.

$staticprop: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Nesciuse moved page $staticprop/en to $staticprop without leaving a redirect: Move en subpage to basepage)
(Cleaned up misinformation & formatted the article more similarly to other QC commands.)
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{this is a|QC command|name=$staticprop}} It tells the model compiler that this model is not intended to have any moving parts. This will cause the compiler to strip away the skeleton & animations to just a single, unmoving bone named <code>static_prop</code>.


{{cleanup|Clean up misinformation; much of this page is written under the misconception that the command is only intended to be used for static props, when it's used for physics props as well.}}
[[prop_static|Static props]] are the only models allowed to cast shadows onto the [[lightmap]] and vice-versa during [[VRAD]].
The [[:Category:QC_Commands|QC command]] '''$staticprop''' specifies that the model being compiled does not have any moving parts, and is used on both static and physics props.
{{note|Despite the name, compiling with [[$staticprop]] does ''not'' limit the model to use with [[prop_static]].}}


==Intended Usage==
A model flagged with <code>$staticprop</code> is ''not'' necessarily limited to just being used with the <code>prop_static</code> [[point entity]]. Neither <code>[[prop_physics]]</code> nor <code>[[prop_static]]</code> will function unless the model was compiled with this command.
Using the command is primarily meant to optimize props meant for ''maps'', as it provides benefits to [[lightmap]] shadows during [[VRAD]] compiles and the commands for it such as <code>-staticproplighting</code> or <code>-staticproppolys</code> commands.


It will also allow the prop to be used as a <code>[[prop_static]]</code> [[point entity]] in maps, as using props without the flag will remove it when [[VBSP]] is run. {{ent|prop_physics}} and {{ent|prop_physics_override}} also must have {{code|$staticprop}}.
{{bug|If the model being compiled has a bone named <code>static_prop</code> already, it can cause the physics model for the prop to be misaligned, should the bone not be oriented how the model compiler expects it to be.}}


===Caveats===
{{bug|[[$bodygroup|Bodygroups]] do not play well with this command. <code>prop_static</code> does not actually support bodygroups anyway, and therefore always defaults to whatever the default bodygroup state is.
Using the static flag command will cause issues in certain circumstances.
* The <code>blank</code> keyword will outright fail compilation with an EXCEPTION_ACCESS_VIOLATION error.
* VRAD will generate lightmaps for each bodygroup, if they're present, even though this is entirely useless.}}


It will remove all bones, and replace all weighted vertices' weights to a new "dummy" bone created during compile named <code>static_prop</code>. If the model being compiled has a bone named static_prop already it will cause the physics model for the prop to be misaligned. If used on a model that has multiple [[$animation|animations]] or [[$sequence|sequences]], it will remove all of them. Be aware of this if the prop is intended to be animated, and use <code>[[prop_dynamic]]</code> instead.
==Example==
$modelname props_junk/metal_paintcan001a.mdl
$staticprop
$body body metal_paintcan001a_lod0
[...]


==See also==
* [[prop_static]]
* [[prop_physics]]


Using the static flag will also cause models to be error prone at times. Models with large numbers of [[$bodygroup|body groups]] will potentially crash the game, throw an error when compiled, and break the <code>blank</code> command in body groups.
Essentially, ''do not'' use <code>$staticprop</code> unless the model is meant for a map or otherwise static prop, as it can cause issues when used on a prop meant to be used in-game.
==Example==
'''$staticprop'''
[[Category:Modeling]]
[[Category:Modeling]]
[[Category:QC_Commands|staticprop]]
[[Category:QC_Commands|staticprop]]
[[Category:Source]]
[[Category:Source]]

Revision as of 16:08, 14 July 2024

English (en)Русский (ru)Translate (Translate)

$staticprop is a QC command available in all Source Source games. It tells the model compiler that this model is not intended to have any moving parts. This will cause the compiler to strip away the skeleton & animations to just a single, unmoving bone named static_prop.

Static props are the only models allowed to cast shadows onto the lightmap and vice-versa during VRAD.

A model flagged with $staticprop is not necessarily limited to just being used with the prop_static point entity. Neither prop_physics nor prop_static will function unless the model was compiled with this command.

Icon-Bug.pngBug:If the model being compiled has a bone named static_prop already, it can cause the physics model for the prop to be misaligned, should the bone not be oriented how the model compiler expects it to be.  [todo tested in ?]
Icon-Bug.pngBug:Bodygroups do not play well with this command. prop_static does not actually support bodygroups anyway, and therefore always defaults to whatever the default bodygroup state is.
  • The blank keyword will outright fail compilation with an EXCEPTION_ACCESS_VIOLATION error.
  • VRAD will generate lightmaps for each bodygroup, if they're present, even though this is entirely useless.  [todo tested in ?]

Example

$modelname props_junk/metal_paintcan001a.mdl
$staticprop
$body body metal_paintcan001a_lod0
[...]

See also