weapon_physcannon

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)
Class hierarchy
CWeaponPhysCannon
CBaseHL2MPCombatWeapon
CWeaponHL2MPBase
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
weapon_physcannon.cpp
Weapon physcannon.png

weapon_physcannon is a point 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

[Todo]

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

Players spawn with a Gravity Gun by default.

KeyValues

Name (targetname) <string>
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]

Obsolete (in all games 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
Fires when an NPC picks up this weapon. (!activator is the NPC.)
OnPlayerUse
Fires when the player +uses this weapon. (!activator is the player.)
OnPlayerPickup
Fires when a player picks up this weapon. (!activator is the player.)
OnCacheInteraction
Fires when the player 'proves' they've found this weapon. Fires on: Player Touch, +USE pickup, Physcannon pickup, Physcannon punt.

Dedicated ConVars

Cvar/CommandParameters or default valueDescriptorEffect
g_debug_physcannon0boolEnables Gravity Gun debugging, which shows a wireframe outline around objects when picked up
physcannon_ball_cone0.997floatThe 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_chargetime2float
Todo: Add a description for this variable.
physcannon_cone0.97floatChanges how wide the pickup range is, lower numbers are wider. This is a dot product value
physcannon_dmg_glass15float
Todo: Add a description for this variable.
physcannon_maxforce1500.0float
Todo: Add a description for this variable.
physcannon_maxmass250.0floatSets the maximum mass at which an object can be picked up by the gravity gun
physcannon_mega_enabled0boolEnables Dark Energy Field Manipulator
physcannon_mega_pullforce8000.0floatHow much force used by Dark Energy Field Manipulator to pull objects to player.
physcannon_mega_tracelength850.0floatThe distance at which the Dark Energy Field Manipulator will be able to pull an object
physcannon_minforce700.0float
Todo: Add a description for this variable.
physcannon_pullforce4000.0floatHow much force to be used when pulling objects to the player
physcannon_punt_cone0.997float
Todo: Add a description for this variable.
physcannon_right_turrets0float
Todo: Add a description for this variable.
physcannon_tracelength250.0floatHow far an object can be pulled from

Console commands

Cvar/CommandParameters or default valueDescriptorEffect
phys_swapSwaps between gravity gun and the most recently-used weapon. Bound to 'g' by default.

See Also