VPhysics: Difference between revisions
mNo edit summary |
TomEdwards (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
''' | '''VPhysics''' is Source's built-in 3D physics simulation engine. VPhysics objects move and collide believably thanks to the system's simulation of [[Wikipedia:Mass|mass]], [[Wikipedia:Gravitation|gravity]], [[Wikipedia:Friction|friction]], [[Wikipedia:Drag (physics)|air resistance]], [[Wikipedia:Inertia|inertia]] and [[Wikipedia:Buoyancy|buoyancy]]. | ||
VPhysics was originally created by modifying the commercial [[Wikipedia:Havok (software)|Havok 2 physics engine]]. | |||
This category of objects includes [[prop_physics|physics props]], physically simulated NPCs (like [[npc_cscanner|scanners]], [[npc_manhack|manhacks]], [[npc_rollermine|rollermines]]), [[func_physbox]] entities, items that can be picked up (like [[weapon_smg1]] or [[item_healthkit]]), drivable vehicles, thrown (and pickupable) frag grenades, and combine AR2 energy balls. | == Collision models == | ||
[[Image:Collisionmesh jointed.jpg|thumb|[[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|You can make the engine draw collision ''meshes'' with the [[console command]] <code>vcollide_wireframe 1</code>.}} | |||
== 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 [[Wikipedia:Quake engine|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 == | |||
* [[Collision mesh]] | |||
* <code>[[IPhysicsObject]]</code> | |||
* [[QPhysics]] | |||
=== Notable VPhysics entities === | |||
* [[prop_physics]] | |||
* [[:Category:Constraints]] | |||
* [[func_clip_vphysics]] | |||
* [[trigger_vphysics_motion]] | |||
* [[func_physbox]] | |||
<!--This category of objects includes [[prop_physics|physics props]], physically simulated NPCs (like [[npc_cscanner|scanners]], [[npc_manhack|manhacks]], [[npc_rollermine|rollermines]]), [[func_physbox]] entities, items that can be picked up (like [[weapon_smg1]] or [[item_healthkit]]), drivable vehicles, thrown (and pickupable) frag grenades, and combine AR2 energy balls. | |||
Other categories include hull simulated (like players, living (non physics based) NPCs, in-flight RPGs and SMG grenades) and ray simulated (bullets). | Other categories include hull simulated (like players, living (non physics based) NPCs, in-flight RPGs and SMG grenades) and ray simulated (bullets). | ||
Line 14: | Line 44: | ||
* [[Prop Data]] and [[func_physbox]] | * [[Prop Data]] and [[func_physbox]] | ||
[[Category:Glossary]] | -->[[Category:Glossary]] |
Revision as of 12:38, 13 June 2009
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 2 physics engine.
Collision models

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.

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.