CPhysicsProp

From Source Entities
Jump to navigation Jump to search

CPhysicsProp is a code class inherited by most physically-simulated model entities.

Classnames:

  • prop_physics - Generic entity used for models that move freely and realistically. Models need to have physics checked in the model browser in order to be used.
  • physics_prop - Older name, automatically converts to prop_dynamic after spawning. No reason to use it.
  • prop_physics_override - Can be used to override the prop data settings and use any model as a physics prop. Normally models are restricted to one or two types of props (dynamic, static, or physics). Automatically changes classname to prop_physics after spawning. It can also be used to set a custom Health amount.)

ConVars/Commands[edit | edit source]

ConVar/CommandParameters or default valueParameter TypeEffect
prop_physics_createstringModelCreates a prop_physics where the player is looking. The parameter is a path to a model file. The models/ prefix and .mdl suffix should be omitted.
sv_turbophysics[Different by game]0 disables, 1 enablesEnables "turbo physics". Makes some optimizations/compromises that make props behave less realistically, but also take less time to compute. Good for multiplayer games but it can be buggy if the game doesn't use it by default.

Flags[edit | edit source]

  • 1: Start Asleep - Prop begins with motion disabled, but it may be enabled at any time by a force acting on it, or the Wake input.
  • 2: Don't take damage physics damage. (No damage from physics forces.)
  • 4: Debris - Prop won't collide with player or other debris. Good for small objects that may get in the player's way or take a long time on physics.
  • 8: Motion Disabled. Use EnableMotion to enable it.
  • 64: Hl2.pngP2.pngEnable motion when grabbed (in any way).
  • 128: Not affected by rotor wash.
  • 256: Generate output on +use - Allow OnPlayerUse to fire.
  • 512: Prevent pickup
  • 1024: Prevent motion enable on player bump - Motion will not be enabled by the player simply running into the prop.
  • 2048: Has attached ragdoll (Not in FGD) - No observable effect
  • 4096: Debris capable of triggering triggers. Requires Debris to be set.
  • 16384: To do: "Radius pickup". Intended for Xbox? (Not in FGD)
  • 1048576: Hl2.pngGravity gun can ALWAYS pick up. No matter what.
  • 2097152: No collisions (Not in FGD) - Don't use, because props will fall through the map.[Confirmed]

Keyvalues[edit | edit source]

Health (health) <integer>
How close to dying the entity is. Only works if using prop_physics_override. Even if this is set, the prop will not take damage if its model is not configured to break.
Mass Scale (massscale) <float>
Multiplier for the object's mass.
Scale Factor For Inertia (inertiascale) <float>
Scales how much the prop spins in reaction to forces. Larger numbers make the prop roll around more and take longer to settle.
Impact damage type (Damagetype) <choices>
Kind of damage done to objects that are hit by this prop.
  • 0: Blunt
  • 1: Sharp
Override Parameters (overridescript) <string>
A list of physics keyvalues that are usually embedded in the model. Format is key,value,key,value,....
Health Level to Override Motion (damagetoenablemotion) <integer>
If specified, this object will start with motion disabled. Once its health has dropped below this specified amount, it will enable motion.
Physics Impact Force to Override Motion (forcetoenablemotion) <float>
If specified, this object will start motion disabled. Any impact that imparts a force greater than this value will enable motion.
Start Fade Distance (fademindist) <float>
Distance at which the entity starts fading. If less than 0, the entity will disappear instantly when the End Fade Distance is hit. The value will scale appropriately if the entity is in a 3D Skybox.
End Fade Distance (fademaxdist) <float>
Distance at which the entity ends fading. If less than 0, the entity won't disappear at all. The value will scale appropriately if the entity is in a 3D Skybox.
Fade Scale (fadescale) <float>
If specified in the worldspawn, or if the game is running below DirectX 8, entities will fade out even if the fade distances above aren't specified. This value gives more control over when this happens: numbers smaller than 1 cause the entity to fade out at further distances, and greater than 1 cause it to fade out at closer distances. Using 0 turns off the forced fade altogether. See also $noforcedfade.
Minimum DX Level (mindxlevel) to Maximum DX Level (maxdxlevel) <choices> (only available in games before Left 4 Dead)
Very outdated settings. Their functionality seems to no longer be fully intact. Nearly all players will be at the highest setting anyway because DirectX 8 has been obsolete since 2002. This is still in the FGD for Alien Swarm, but it doesn't use it.
Minimum CPU Level (mincpulevel) to Maximum CPU Level (maxcpulevel) <choices> (available in all games since L4d.png)
A user with the "effect detail" setting not in this specific range will not see this object.
  • 0: Default
  • 1: Low
  • 2: Medium
  • 3: High
Minimum GPU Level (mingpulevel) to Maximum GPU Level (maxgpulevel) <choices> (available in all games since L4d.png)
A user with the "shader detail" setting not in this specific range will not see this object. Settings are named differently in different games.
  • 0: Default
  • 1: Very low or Low
  • 2: Low or Medium
  • 3: Medium or High
  • 4: High or Very High
Can Obstruct Nav Areas (CanObstructNav) <boolean> (only available in L4d.png)
Can this prop be counted as an obstruction by bots? To do: How do bots react to this?
Breakable By (BreakableType) <choices> (only available in L4d.pngL4d2-small.png)
Who can break this?
  • 0: Everyone
  • 1: All Infected
  • 2: Only Tanks
Glow State (glowstate) <choices> (only available in L4d2-small.png)
In Left 4 Dead 2, props may have a glow around them. This sets when the glow will appear.
  • 0: OFF (must be turned on with StartGlowing)
  • 1: +use enables glow
  • 2: look-at (look at the prop to enable the glow)
  • 3: ON (starts enabled)
Glow Range (glowrange) <integer> (only available in L4d2-small.png)
Viewer must be this close to the see the glow. 0 means ignore this limit.
Glow Range Min (glowrangemin) <integer> (only available in L4d2-small.png)
Once the viewer is this close to the object, the glow will stop. 0 means ignore this limit. Should be less than Glow Range.
Glow Color Override (R G B) (glowcolor) <color255> (only available in L4d2-small.png)
Color of the glow.
Exploitable by Player (ExploitableByPlayer) <choices> (available in all games since L4d2-small.png)
No effect.
Immune to bullet forces (BulletForceImmune) <boolean> (only available in Asw.png)
Set to Yes to make this prop not be pushed around by bullet damage.
Allow Portal Funneling (allowfunnel) <boolean> (only available in P2.png)
Whether or not this object should auto-funnel into portals.

Inputs[edit | edit source]

Sleep
Tell the prop to quit moving. Any physics forces (excluding gravity and water buoyancy) will cause the object to resume moving as usual. Sleeping also occurs automatically when the object has no physics forces to keep it awake, and is no longer moving a noticeable amount.
Wake
If the object was told to sleep, tell it to start moving again.
DisableMotion
Tell the object to stop moving completely. No physics forces will re-enable motion, not even Wake.
EnableMotion
If the object's motion has been disabled entirely, tell it to resume movement as usual. This will also Wake the object, if it is Sleeping.
DisableFloating
If the object would normally float when in water, tell it to not float. There seems to be no way to re-enable floating behavior, but programming a method to do this should be fairly simple.
EnableNavObstruction  (only available in L4d.png)
Allows prop to count as an obstruction in the nav mesh.
DisableNavObstruction  (only available in L4d.png)
Disallows prop from counting as an obstruction in the nav mesh.
StartGlowing  (only available in L4d2-small.png)
Creates a glow effect around the prop.
StopGlowing  (only available in L4d2-small.png)
Turns off glow effect around the prop.
SetGlowOverride (Not in FGD) <color255> (only available in L4d2-small.png)
Sets Glow Color Override.
SetGlowRange (Not in FGD) <integer> (only available in L4d2-small.png)
Sets Glow Range.

Outputs[edit | edit source]

OnAwakened
Fires when the prop has woken (force was applied to it while asleep, or the Wake input was sent).
OnMotionEnabled
Fires when motion has been enabled on the prop, either via the Health Level to Override Motion or Physics Impact Force to Override Motion keyvalues, or from the EnableMotion input.
OnPhysGunPickup
Fires when the prop is picked up with +use or the Hl2.pnggravity gun.
OnPhysGunOnlyPickupHl2.png
Fires when the player has picked the prop up with the gravity gun specifically.
OnPhysGunPuntHl2.png
Fires when this object is punted by the gravity gun.
OnPhysGunDrop
Fires when the player has dropped the prop (from either +use or the Hl2.pnggravity gun). Activator is the player.
OnPlayerUse
Fires when the player has +used the prop. Requires Generate output on +use to be checked.
OnPlayerPickup
Always fires under the same conditions as OnPhysGunPickup.
OnOutOfWorld
Fires whenever the object is detected to be outside the world. Specifically, it checks if the object is outside of the world's bounding box or if the object is traveling at over 2000 units per second in any cardinal direction.
OnScavengeSpawn  (only available in L4d.png)
If the model used is models/props_equipment/oxygentank01.mdl (the oxygen tank model) or models/props_junk/propanecanister001a.mdl (the propane tank model), fires if the prop is randomly chosen to spawn.
OnHitByTank  (only available in L4d2-small.png)
Fires when this object is punched by a tank.

See Also[edit | edit source]