Gravity in Source is measured in units/second2. The value is defined by
sv_gravity, which defaults to 600 in Half-Life 2 (and episodes), Portal, and Portal 2. Default gravity is 800 in Valve's other games.
void physenv->SetGravity(Vector &gravityVector)
- Sets the direction and strength of gravity for the VPhysics environment, which can be changed at any time independently of sv_gravity. Physics objects will sleep on the 'floor' no matter which direction it is in, but they will not wake of their own accord if gravity changes. Tip: Z should be negative for downward pull.Note: Changes must be manually networked to the client.
void IPhysicsObject::EnableGravity(bool enable)
- Controls per-entity zero gravity. The object will tumble through the air if pushed.
- To do: Is there a way to set a gravity multiplier?
void CBaseEntity::PhysicsAddGravityMove(Vector &move)
sv_gravityto add gravity to falling QPhysics entities (To do: including NPCs?).
- As above, but for players.
void CBaseEntity::SetGravity(float gravity)
- Sets a per-entity multiplier for QPhysics gravity. Default is 0, which should be considered 1. Tip: The Hammer keyvalue gravity can be used to add a gravity multiplier to individual QPhysics entities (which more or less means NPCs these days) without any new code. It isn't in the FGD so turn off SmartEdit and add it manually.