VPhysics: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎See also: Added link to more in-depth article)
Line 21: Line 21:
== See also ==
== See also ==


* [[Vphysics & Qphysics]]
* [[Physics Entities on Server & Client]]
* [[Physics Entities on Server & Client]]
* [[Collision mesh]]
* [[Collision mesh]]

Revision as of 15:20, 10 May 2011

VPhysics is Source's built-in 3D physics simulation engine. VPhysics objects move and collide believably thanks to the system's simulation of mass, gravity, friction, air resistance, inertia and buoyancy.

VPhysics was originally created by modifying the commercial Havok 1 and 2 physics engines.

Collision models

Dr. Breen's jointed collision mesh.

VPhysics objects ("collision models") are invisible, because in order for the simulation to be efficient they must be extremely simple. The visible part of an entity will obviously be a close match to the shape of the VPhysics object, but it is entirely ignored by the simulator.

Collision models are typically loaded from a collision mesh embedded inside an entity's assigned model, but they can also generated from, for instance, a bounding box.

Tip.pngTip:You can make the engine draw collision meshes with the console command vcollide_wireframe 1.

QPhysics

VPhysics co-exists with QPhysics (a retroactive name - it's only ever referred to in the codebase as "game physics"), an older and far less sophisticated simulator that Source inherits from Quake. QPhysics is still used for players and walking NPCs because full VPhysics would lead to situations too complex for either AI or players to handle. Vehicles and flying NPCs do use VPhysics, however.

QPhysics entities are given a VPhysics "shadow" that allows them to interact with VPhysics entities in a limited way.

See also

Notable VPhysics entities