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

Func clip vphysics: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Clarifying something I went to the trouble of making a test map to be sure of.)
No edit summary
 
(19 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{base brush|func_clip_vphysics}}  
[[File:Toolsnodraw.gif|left]]
{{CD|CFuncVPhysicsClip|file1=bmodels.cpp}}
{{this is a|brush entity|name=func_clip_vphysics}} It is considered solid to [[VPhysics]] objects (such as a {{ent|prop_physics}}). [[QPhysics]] objects (such as {{ent|player}}s) can pass freely. It can also use a filter to only collide with specific objects.


==Entity description==
In simple terms, it's an invisible wall that blocks objects but not players.
It is considered solid to [[VPhysics|vphysics]]; in layman's terms, an invisible wall. It is not solid to players.
{{note|Any normal material can be used on this entity's brush faces; a material with {{cmd|%CompileNoDraw}} and/or {{cmd|%CompileTrigger}} is recommended. Vphysics clip brushes are not drawn with {{cmd|r_drawclipbrushes}} or {{cmd|showtriggers_toggle}}.}}
{{bug|"Start Disabled" is not functional. It must be disabled by another entity. A fix is available below.}}
{{bug*|<code>StartDisabled</code> is a keyvalue in Hammer, but it is not present in the code. Use a {{ent|logic_auto}} and the <code>Disable</code> input instead.  
{{expand|title=Code fix|{{fix|In <code>bmodels.cpp</code>, find <code>BEGIN_DATADESC( CFuncVPhysicsClip )</code> and replace <code>DEFINE_FIELD( m_bDisabled, FIELD_BOOLEAN )</code> with <code>DEFINE_KEYFIELD( m_bDisabled, FIELD_BOOLEAN, "StartDisabled" )</code>. No changes to the FGDs or existing maps are required.|code}}}}}}


In code it is represented by class CFuncVPhysicsClip, defined in bmodels.cpp.
==Keyvalues==
 
== Keyvalues ==
{{KV|Filter Name|filterclass|Filter to use to see if activator collides with me. See filter_activator_name for more explanation. Allow means 'Allow to Block' for this entity.}}
{{KV Targetname}}
{{KV Targetname}}
{{KV EnableDisable}}
{{KV|Filter Name|intn=filtername|filterclass|[[Filter]] to use to see if activator collides with this entity.}}
 
== Inputs ==
{{I Targetname}}
{{I EnableDisable}}
 
== Outputs ==
{{O Targetname}}


==Fixing Start Disabled Behavior==
==Inputs==
By default, start disabled is unsupported by this entity, but this can be easily corrected in code.
{{I|Enable|Enable collision}}
To start, edit line 1355 of bmodels.cpp to read:
{{I|Disable|Disable collision}}
<source lang=cpp>DEFINE_KEYFIELD( m_bDisabled, FIELD_BOOLEAN, "startdisabled" ),</source>


Then, simply add the new keyfield to func_clip_vphysics's definition in your mod's base FGD.<br>
== See also ==
<code>
* {{l4d2}}{{ent|script_clip_vphysics}}
startdisabled(choices) : "Start Disabled" : 0 : "The entitiy's default state" =
[
0 : "No"
1 : "Yes"
]
</code>


[[Category:Physics]]
[[Category:Physics]]

Latest revision as of 13:28, 17 September 2024

Toolsnodraw.gif
C++ Class hierarchy
CFuncVPhysicsClip
CBaseEntity
C++ bmodels.cpp

func_clip_vphysics is a brush entity available in all Source Source games. It is considered solid to VPhysics objects (such as a prop_physics). QPhysics objects (such as players) can pass freely. It can also use a filter to only collide with specific objects.

In simple terms, it's an invisible wall that blocks objects but not players.

Note.pngNote:Any normal material can be used on this entity's brush faces; a material with %CompileNoDraw and/or %CompileTrigger is recommended. Vphysics clip brushes are not drawn with r_drawclipbrushes or showtriggers_toggle.
Icon-Bug.pngBug*:StartDisabled is a keyvalue in Hammer, but it is not present in the code. Use a logic_auto and the Disable input instead.
Code fix
Cpp.pngCode Fix:In bmodels.cpp, find BEGIN_DATADESC( CFuncVPhysicsClip ) and replace DEFINE_FIELD( m_bDisabled, FIELD_BOOLEAN ) with DEFINE_KEYFIELD( m_bDisabled, FIELD_BOOLEAN, "StartDisabled" ). No changes to the FGDs or existing maps are required.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Filter Name (filtername) <filter>
Filter to use to see if activator collides with this entity.

Inputs

Enable
Enable collision
Disable
Disable collision

See also