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

prop_physics

From Valve Developer Community
(Redirected from Physics prop)
Jump to: navigation, search
class hierarchy
CPhysicsProp defined in props.cpp
CBreakableProp
CBaseProp
CBaseAnimating
CBaseEntity

prop_physics is a point entity available in all Source Source games. It is used to add rigid, VPhysics-simulated models to the world.

The only value required for prop_physics to work is a path to a model. As long as that model is physics-enabled, the correct data will be loaded from it when the map starts. It is possible to change any embedded physics data with the "Override Parameters" keyvalue.

Physics objects like prop_physics can be parented, though it is not in the default FGD and may not function correctly. It is recommended to instead use dynamic physics constraints. See Physics Entity Overview for more information.

Tip.pngTip:Multiplayer maps should use prop_physics_multiplayer, which works better with the collision prediction code.
Do not use prop_physics_respawnable; it will crash the server if destroyed by a trigger_hurt.
Tip.pngTip:To create a jointed physics object, use prop_ragdoll.
AltNames.pngAltNames: This entity is also tied to physics_prop. The classname is always changed to prop_physics on spawn.

Consistency

Blank image.pngTodo: Move this section to its own article.

Consistency becomes a large problem when dealing with the many prop models that the Source engine provides. From a player's perspective, object interactivity should remain consistent across all the levels of your game / mod, as players will often have a hard time solving puzzles or making quick decisions if the prop's behaviour is different in only one specific instance. To enforce this, the game-related data of props is stored within the model itself.

For example, imagine you have a crate that is immovable for the entirety of your game and the player has gotten used to that crate being static. However, in one specific instance, this crate is not moveable and required to be moved to proceed. This can cause lots of irritation and confusion, and therefore is why consistency is necessary. Oftentimes, developers will use different skins or models to convey differences in behaviour and keep consistency.

Models that are meant to be physically simulated (chairs, tables, wooden planks, etc) will remove themselves if they are placed as prop_static or prop_dynamic entities (You can still use these as static props using the entity prop_dynamic_override). Other game-related data, such as mass, "health", gib amount & models, and so on are all stored inside the prop model as well.

The method by which they are stored, and guidelines for how to set it up, can be found in the Prop Data section of the model's QC file.

Keyvalues

Name (targetname) <string>
The targetname that other entities refer to this entity by.

BasePropPhysics:

Physics Impact Damage Scale (physdamagescale) <float>
Multiplies damage received from physics impacts. 0 means the feature is disabled for backwards compatibility.
Impact damage type (Damagetype) <boolean>
If true (1), damage type is sharp and the object can slice others.
Damaging it Doesn't Push It (nodamageforces) <boolean>
Whether damaging the entity applies force to it.
Scale Factor For Inertia (inertiascale) <float>
Scales the angular mass of an object. Used to hack angular damage and collision response.
Confirm:Doesn't actually affect inertia?
Mass Scale (massscale) <float>
Multiplier for the object's mass.
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.

BreakableProp:

Explosion Damage (ExplodeDamage) <float>
If non-zero, when this entity breaks it will create an explosion that causes the specified amount of damage. See also Explosion Radius.
Explosion Radius (ExplodeRadius) <float>
If non-zero, when this entity breaks it will create an explosion with a radius of the specified amount. See also Explosion Damage.
Sound to make when punted (puntsound) <sound> (in all games since Half-Life 2: Episode One)
Sound to make when punted by gravity gun.
Break Model Message (BreakModelMessage) <string>
"If set, will use this break model message instead of the normal break behavior."
Confirm:Is this new with Source SDK 2013...? It isn't in Alien Swarm or 2007 code but is in 2013. New with L4D?

Breakable (common):

Performance Mode (PerformanceMode) <choices>
Used to limit the amount of gibs produced when this entity breaks, for performance reasons.
  • 0: Normal
  • 1: No Gibs
  • 2: Full Gibs on All Platforms (Xbox 360, PS3, etc)
  • 3: Reduced gibs
Min Damage to Hurt (minhealthdmg) <integer>
If a single hit to the object doesn't do at least this much damage, the prop won't take any of the damage it attempted to give.
Pressure Delay (pressuredelay) <float>
Seconds to delay breaking from pressure. Allows creaking/groaning sounds to play.
Health (health) <integer>
How close to breaking the object is.
Maximum Health (max_health) <integer>
Health cannot exceed this amount.
Physics Impact Damage Scale (physdamagescale) <float>
Multiplier for damage amount when this entity is hit by a physics object. With a value of 0 the entity will take no damage from physics.
Breakable By (BreakableType) <choices> (only in Left 4 Dead series)
Who can break this?
  • 0: Everyone
  • 1: All Infected
  • 2: Only Tanks

GMODSandbox:

Allow Physics Gun (gmod_allowphysgun) <boolean> (only in Garry's Mod)
If set, players cannot use Physics Gun on this entity.
Sandbox Tool Whitelist (gmod_allowtools) <string> (only in Garry's Mod)
If set, only given tools can be used on this entity. You need to supply the tool class names, the names of the .lua files of those tools. This also includes the context menu properties!

Flags

BasePropPhysics:

  •  [2] : Don't take physics damage
  •  [4] : Debris
       Don't collide with the player or other debris.
  •  [8] : Motion Disabled
       Starts with motion disabled until sent EnableMotion.
  •  [64] : Enable motion when grabbed by gravity gun
  •  [256] : Generate output on +use
  •  [512] : Prevent pickup
  •  [1024] : Prevent motion enable on player bump.
  •  [2048] : Has Attached Ragdolls !FGD
       Set by the game when ragdolls are attached, detaches them when prop moves
Note.pngNote:Used solely by props with the "impale" prop interaction (PROPINTER_PHYSGUN_FIRST_IMPALE), such as the harpoons in Half-Life 2 (not to be confused with the crossbow bolts, which use a different method for pinning ragdolls). It is best not to assign this spawnflag manually.
  •  [4096] : Debris with trigger interaction.
Note.pngNote:Does not enable Debris behavior on its own. Needs to be used together with the Debris spawnflag or with the PROPINTER_PHYSGUN_CREATE_FLARE prop interaction.
Icon-Bug.pngBug:In Left 4 Dead 2 when breakable prop has Force server-side flag set then nav areas under it will be marked MOB_ONLY
  •  [16384] : Radius Pickup !FGD
       Makes objects easier to grab
  •  [1048576] : Gravity gun can ALWAYS pick up. No matter what.
  •  [2097152] : No Collisions !FGD
       Disable collisions on spawn
  •  [4194304] : Gib !FGD
       If debris, remove when stuck in a collision
  •  [4194304] : Attempt to override gib with the character gib system (only in Black Mesa)
  •  [8388608] : Zombies can't swat (only in Mapbase)
       Zombies will ignore this prop when looking for an object to swat at the enemy.

BreakableProp:

  •  [16] : Break on Touch
  •  [32] : Break on Pressure

Inputs

BasePropPhysics:

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 when it 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 not to float. There seems to be no way to re-enable floating behavior, but programming a method to do this should be fairly simple (CALLBACK_DO_FLUID_SIMULATION).

BreakableProp:

Break
Breaks the breakable.
SetHealth <integer>
Sets a new value for the breakable's health. If the breakable's health reaches zero it will break.
AddHealth <integer>
Adds health to the breakable.
RemoveHealth <integer>
Removes health from the breakable.
physdamagescale <float>
Sets Physics Impact Damage Scale. 0 means this feature is disabled for backwards compatibility.
EnablePhyscannonPickup
Makes the breakable able to picked up by the gravity gun.
DisablePhyscannonPickup
Makes the breakable not able to picked up by the gravity gun.
EnablePuntSound  (in all games since Half-Life 2: Episode One)
Allow this prop from playing its Punt Sound sound when punted by the gravity gun.
DisablePuntSound  (in all games since Half-Life 2: Episode One)
Prevent this prop from playing its Punt Sound sound when punted by the gravity gun.

Outputs

OnMotionEnabled
Fired when motion has been enabled on the prop, either via the Health Level to Override Motion keyvalue or from the EnableMotion input.
OnAwakened
Fired when the prop has woken (force has been applied to it while it was asleep, or the Wake input has been called).
OnOutOfWorld
Fired 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.
OnPlayerUse
Fired when the player has +used the prop.
Note.pngNote:This output (but not any of the other pickup-related ones) will fire only if the Generate output on +USE spawnflag is set.
OnPhysGunDrop
Fired when the player has dropped the prop (from either +use or the gravity gun). !activator is the player.
OnPlayerPickup
Fired when the player has picked the prop up with +use or the gravity gun (in Half-Life 2).
OnPhysGunOnlyPickup  (in all games since Half-Life 2)
Fired when the player has picked the prop up with the gravity gun specifically.
OnHitByTank  (in all games since Left 4 Dead 2)
Fired when the prop has been punched by a Tank boss infected.

BreakableProp:

OnBreak
Fired when this object breaks. !activator is whatever breaks the object.
OnHealthChanged <float>
Fired whenever the health of the breakable has increased or decreased. This output automatically puts the new health amount as a decimal percent (e.g. 45% = 0.45) into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnTakeDamage
Fired when damage is taken.
OnPhysCannonAnimatePreStarted
Fired when prop starts its ACT_PHYSCANNON_ANIMATE_PRE activity. Caused by the object being picked up by the gravity gun.
OnPhysCannonAnimatePullStarted
Fired when prop has started its ACT_PHYSCANNON_ANIMATE activity. ACT_PHYSCANNON_ANIMATE_PRE plays once, then ACT_PHYSCANNON_ANIMATE starts looping.
OnPhysCannonDetach
Fired when prop has started its ACT_PHYSCANNON_DETACH activity (caused by the gravity gun ripping it from a wall).
OnPhysCannonAnimatePostStarted
Fired when prop has started its ACT_PHYSCANNON_ANIMATE_POST activity (caused by the player letting the prop go from the gravity gun).
OnPhysCannonPullAnimFinished
Fired when prop has finished all gravity gun-related animations.

See also