Weapon physcannon: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(categorization, formatting)
m (Classifying as model entity)
 
(57 intermediate revisions by 19 users not shown)
Line 1: Line 1:
{{hl2 point|weapon_physcannon}}
{{LanguageBar}}
[[Image:weapon_physcannon.png|thumb|right|250px]]
{{CD|CWeaponPhysCannon|file1=1}}
[[File:weapon_physcannon.png|thumb|right|250px]]
{{this is a|model entity|name=weapon_physcannon|game=Half-Life 2 series|game1=Portal}}


== Entity description ==
It's the '''Zero-Point Energy Field Manipulator''' (AKA Gravity Gun), used to manipulate physics objects in the game world. Before it is picked up, the gravity gun also follows all physics rules as if it were a {{ent|prop_physics}}.
A gravity gun, used to manipulate physics objects in the game world. In [[Half-Life 2: Deathmatch]], the player spawns with a gravity gun by default.


Before it is picked up, the gravity gun also follows all physics rules as if it were a [[prop_physics]].  
The Zero-Point Energy Field Manipulator was designed for handling hazardous materials, but the people at Eli's lab mainly used it for heavy lifting.


{{tip|To upgrade the gravity gun to the super gravity gun, you will have to set up an [[env_global]] entity to enable it.}}
It does not require any ammunition or recharging. Special interactions between a physics prop and the gravity gun are defined by the physgun_interactions in the model's QC file.


== Dedicated Console Variables  ==
Gravity Gun has two attacks: punt and grab. Primary attack emits a charge, making props fly. Secondary attack attracts prop to the gun and grabs it. In this state, primary attack throws the prop, secondary attack releases it.
{{ScrollBox|title=Dedicated Console Variables|
;g_debug_physcannon <[[bool]]>
: {{Todo|Add a description for this variable.}}(Default: 0)


;physcannon_cone <[[float]]>
The effective range of each attack depends largely on the mass of the prop. Some NPCs ([[npc_antlion|antlions]] and [[headcrab|headcrabs]]) are pushed back by the impact of a punt at close range.
: {{Todo|Add a description for this variable.}}(Default: 0.97)


;physcannon_ball_cone <[[float]]>
{{tip|To supercharge the Gravity Gun, use an {{ent|env_global}} entity to enable the global state <code>super_phys_gun</code>. This does not work in {{hl2dm|3}} nor {{portal|3}}.}}
: {{Todo|Add a description for this variable.}}(Default: 0.997)
{{bug|Sometimes the game may crash when the player is holding something at the moment they pick up the gravity gun.}}


;physcannon_punt_cone <[[float]]>
==Games==
: {{Todo|Add a description for this variable.}}(Default: 0.997)
==={{hl2|4.1}}===
Player obtains the Gravity Gun given by [[npc_alyx|Alyx]] on {{code|d1_eli_02}} ([[Black Mesa East]]).


;physcannon_minforce <[[float]]>
==={{hl2ep1|4.1}} and {{hl2ep2|4.1}}===
: {{Todo|Add a description for this variable.}}(Default: 700.0)
On the beginning of both {{hl2ep1|1}} and {{hl2ep2|1}}, player obtains the Gravity Gun given by [[npc_dog|Dog]] on {{code|ep1_citadel_00}} ([[Undue Alarm]], EP1), and [[npc_alyx|Alyx]] on {{code|ep2_outland_01}} ([[To The White Forest]], EP2).


;physcannon_maxforce <[[float]]>
Players spawn with a Gravity Gun on all maps after the beginning of both Episode One and Two.
: {{Todo|Add a description for this variable.}}(Default: 1500.0)


;physcannon_maxmass <[[float]]>
==={{hl2dm|4.1}}===
: {{Todo|Add a description for this variable.}}(Default: 250.0)
[[Player]]s spawn with a Gravity Gun by default.
==={{portal|4.1}}===
Only available if placed in a custom map or using a cheat such as {{cmd|impulse|101}} or {{cmd|give|weapon_physcannon}}.


;physcannon_pullforce <[[float]]>
==KeyValues==
: {{Todo|Add a description for this variable.}}(Default: 4000.0)
{{KV Targetname}}


;physcannon_tracelength <[[float]]>
==Flags==
: {{Todo|Add a description for this variable.}}(Default: 250.0)
{{fl|1|Start Constrained|Prevents the model from moving. Off by default.}}
{{fl|2|Start without grab functionality.|removed={{hl2ep1}}}}
{{fl|2|Deny player pickup (reserve for NPC)|since=EP1}}
{{fl|4|Not puntable by Gravity Gun|since=EP1}}


;physcannon_mega_enabled <[[bool]]>
==Inputs==
: {{Todo|Add a description for this variable.}}(Default: 0)
{{I|EnableGrab|Enable the grab functionality. Obsolete {{ep1|since}}}}
{{I Weapon}}


;physcannon_mega_pullforce <[[float]]>
==Outputs==
: {{Todo|Add a description for this variable.}}(Default: 8000.0)
{{O Weapon}}


;physcannon_mega_tracelength <[[float]]>
== Dedicated [[console variable]]s ==
: {{Todo|Add a description for this variable.}}(Default: 850.0)
{{varcom|start}}
{{varcom|g_debug_physcannon|0|bool|Enables Gravity Gun debugging, which shows a wireframe outline around objects when picked up}}
{{varcom|physcannon_ball_cone|0.997|float|The dot product of the search cone when using the charged Gravity Gun; if it detects a [[Prop combine ball]] within this cone, it'll prioritize picking it up}}
{{varcom|physcannon_chargetime|2|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_cone|0.97|float|Changes how wide the pickup range is, lower numbers are wider. This is a [[dot product]] value}}
{{varcom|physcannon_dmg_glass|15|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_maxforce|1500.0|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_maxmass|250.0|float|Sets the maximum mass at which an object can be picked up by the gravity gun}}
{{varcom|physcannon_mega_enabled|0|bool|Enables Dark Energy Field Manipulator {{Fix|[[Half-Life 2: Deathmatch Zero Point Energy Field Manipulator fix]].|code}}}}
{{varcom|physcannon_mega_pullforce|8000.0|float|How much force used by Dark Energy Field Manipulator to pull objects to player.}}
{{varcom|physcannon_mega_tracelength|850.0|float|The distance at which the Dark Energy Field Manipulator will be able to pull an object}}
{{varcom|physcannon_minforce|700.0|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_pullforce|4000.0|float|How much force to be used when pulling objects to the player}}
{{varcom|physcannon_punt_cone|0.997|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_right_turrets|0|float|{{Todo|Add a description for this variable.}}}}
{{varcom|physcannon_tracelength|250.0|float|How far an object can be pulled from}}
{{varcom|end}}


;player_throwforce <[[float]]>
==Console commands==
: {{Todo|Add a description for this variable.}}(Default: 1000.0)
{{varcom|start}}
{{varcom|phys_swap|||Swaps between gravity gun and the most recently-used weapon. Bound to 'g' by default.}}
{{varcom|end}}


}}
==See Also==
 
* [[Half-Life 2: Deathmatch Zero Point Energy Field Manipulator fix]]
== Keyvalues ==
* {{KV Targetname}}
* {{KV Angles}}
* {{KV NewFade}}
 
== Flags ==
* 1 : Start Constrained
:Prevents the model from moving. Off by default.
 
* 2 : Start without grab functionality. {{EP1 add|Obsolete}}
 
* {{EP1 add|2 : Deny player pickup (reserve for NPC)}}
* {{EP1 add|4 : Not puntable by Gravity Gun}}
 
== Inputs ==
* {{I Targetname}}
 
* '''EnableGrab'''
: Enable the grab functionality. {{EP1 add|Obsolete}}
 
== Outputs ==
* {{O Targetname}}
 
* {{O Weapon}}
*'''OnNPCPickup'''
: Fires when an NPC picks up this weapon.


[[Category:Half-Life 2 Entities]]
[[Category:Half-Life 2 Entities]]
[[Category:Half-Life 2 Weapons|P]]
[[Category:Half-Life 2 Weapons|P]]

Latest revision as of 04:36, 19 May 2025

English (en)Translate (Translate)
C++ Class hierarchy
CWeaponPhysCannon
CBaseHL2MPCombatWeapon
CWeaponHL2MPBase
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
C++ weapon_physcannon.cpp
Weapon physcannon.png

weapon_physcannon is a model entity available in Half-Life 2 series Half-Life 2 series and Portal Portal.

It's the Zero-Point Energy Field Manipulator (AKA Gravity Gun), used to manipulate physics objects in the game world. Before it is picked up, the gravity gun also follows all physics rules as if it were a prop_physics.

The Zero-Point Energy Field Manipulator was designed for handling hazardous materials, but the people at Eli's lab mainly used it for heavy lifting.

It does not require any ammunition or recharging. Special interactions between a physics prop and the gravity gun are defined by the physgun_interactions in the model's QC file.

Gravity Gun has two attacks: punt and grab. Primary attack emits a charge, making props fly. Secondary attack attracts prop to the gun and grabs it. In this state, primary attack throws the prop, secondary attack releases it.

The effective range of each attack depends largely on the mass of the prop. Some NPCs (antlions and headcrabs) are pushed back by the impact of a punt at close range.

Tip.pngTip:To supercharge the Gravity Gun, use an env_global entity to enable the global state super_phys_gun. This does not work in Half-Life 2: Deathmatch nor Portal.
Icon-Bug.pngBug:Sometimes the game may crash when the player is holding something at the moment they pick up the gravity gun.  [todo tested in ?]

Games

Half-Life 2 Half-Life 2

Player obtains the Gravity Gun given by Alyx on d1_eli_02 (Black Mesa East).

Half-Life 2: Episode One Half-Life 2: Episode One and Half-Life 2: Episode Two Half-Life 2: Episode Two

On the beginning of both Half-Life 2: Episode One and Half-Life 2: Episode Two, player obtains the Gravity Gun given by Dog on ep1_citadel_00 (Undue Alarm, EP1), and Alyx on ep2_outland_01 (To The White Forest, EP2).

Players spawn with a Gravity Gun on all maps after the beginning of both Episode One and Two.

Half-Life 2: Deathmatch Half-Life 2: Deathmatch

Players spawn with a Gravity Gun by default.

Portal Portal

Only available if placed in a custom map or using a cheat such as impulse 101 or give weapon_physcannon.

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

Flags

Start Constrained : [1]
Prevents the model from moving. Off by default.
Start without grab functionality. : [2] (removed since Half-Life 2: Episode One)
Deny player pickup (reserve for NPC) : [2] (in all games since Half-Life 2: Episode One)
Not puntable by Gravity Gun : [4] (in all games since Half-Life 2: Episode One)

Inputs

EnableGrab
Enable the grab functionality. Obsolete (in all games since Half-Life 2: Episode One)
HideWeapon  !FGD
If this weapon is being held, hide the worldmodel and/or viewmodel via EF_NODRAW. Weapon will still be useable. The weapon will become visible again if the holder is to switch between weapons in their inventory.

Outputs

Weapon:

OnNPCPickup
!activator = NPC
!caller = this entity
Fires when an NPC picks up this weapon.
OnPlayerUse
!activator = player
!caller = this entity
Fires when the player +uses this weapon.
OnPlayerPickup
!activator = player
!caller = this entity
Fires when a player picks up this weapon.
OnCacheInteraction
Fires when the player 'proves' they've found this weapon. Fires on: Player Touch, +USE pickup, Physcannon pickup, Physcannon punt.

Dedicated console variables

Cvar/Command Parameters or default value Descriptor Effect
g_debug_physcannon 0 bool Enables Gravity Gun debugging, which shows a wireframe outline around objects when picked up
physcannon_ball_cone 0.997 float The dot product of the search cone when using the charged Gravity Gun; if it detects a Prop combine ball within this cone, it'll prioritize picking it up
physcannon_chargetime 2 float
Todo: Add a description for this variable.
physcannon_cone 0.97 float Changes how wide the pickup range is, lower numbers are wider. This is a dot product value
physcannon_dmg_glass 15 float
Todo: Add a description for this variable.
physcannon_maxforce 1500.0 float
Todo: Add a description for this variable.
physcannon_maxmass 250.0 float Sets the maximum mass at which an object can be picked up by the gravity gun
physcannon_mega_enabled 0 bool Enables Dark Energy Field Manipulator
physcannon_mega_pullforce 8000.0 float How much force used by Dark Energy Field Manipulator to pull objects to player.
physcannon_mega_tracelength 850.0 float The distance at which the Dark Energy Field Manipulator will be able to pull an object
physcannon_minforce 700.0 float
Todo: Add a description for this variable.
physcannon_pullforce 4000.0 float How much force to be used when pulling objects to the player
physcannon_punt_cone 0.997 float
Todo: Add a description for this variable.
physcannon_right_turrets 0 float
Todo: Add a description for this variable.
physcannon_tracelength 250.0 float How far an object can be pulled from

Console commands

Cvar/Command Parameters or default value Descriptor Effect
phys_swap Swaps between gravity gun and the most recently-used weapon. Bound to 'g' by default.

See Also