Gravity: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
'''Gravity''' in source is measured in [[unit]]s/second<sup>2</sup>. The value is defined by '''<code>sv_gravity</code>''', which defaults to 600 in Half-Life 2 (and episodes) and 800 in Valve's other games.
'''Gravity''' in Source is measured in [[unit]]s/second<sup>2</sup>. The value is defined by '''<code>sv_gravity</code>''', which defaults to 600 in Half-Life 2 (and episodes) and 800 in Valve's other games.


== C++ ==
== C++ ==

Revision as of 13:49, 12 June 2009

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?
    ).