Gravity: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 3: Line 3:
== C++ ==
== C++ ==


* '''<code>physenv->SetGravity([[Vector]] &gravityVector)</code>''' defines gravity for the [[VPhysics]] environment, and can be changed at any time. {{note|Z should be ''negative'' for downward pull.}}
* '''<code>physenv->SetGravity([[Vector]] &gravityVector)</code>''' defines gravity for the [[VPhysics]] environment, and can be changed at any time. {{note|Z should be ''negative'' for downward pull.}} {{tip|Physics objects will sleep on the 'floor' no matter which direction it is in. However, they will ''not'' wake simply if gravity changes.}}
** Physics objects will sleep on the 'floor' no matter which direction it is in. However, they will ''not'' wake simply if gravity changes.
* <code>sv_gravity</code> is used by '''<code>CGameMovement::AddGravity()</code>''' to define gravity on players ({{todo|and NPCs?}}).
* <code>sv_gravity</code> is used by '''<code>CGameMovement::AddGravity()</code>''' to define gravity on players ({{todo|and NPCs?}}).


[[Category:Glossary]]
[[Category:Glossary]]
[[Category:Programming]]
[[Category:Programming]]

Revision as of 10:35, 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?
    ).