Gravity

From Valve Developer Community
Revision as of 10:35, 12 June 2009 by TomEdwards (talk | contribs)
Jump to navigation Jump to search

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) and 800 in Valve's other games.

C++

  • physenv->SetGravity(Vector &gravityVector) defines gravity for the VPhysics environment, and can be changed at any time.
    Note.pngNote:Z should be negative for downward pull.
    Tip.pngTip:Physics objects will sleep on the 'floor' no matter which direction it is in. However, they will not wake simply if gravity changes.
  • sv_gravity is used by CGameMovement::AddGravity() to define gravity on players (
    Todo: and NPCs?
    ).