# Sandbox.PhysicsWorld

A world in which physics objects exist. You can create your own world but you really don't need to. A world for the map is created clientside and serverside automatically.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Modifiers: sealed

## Constructors

- [`PhysicsWorld`](/api/Sandbox.PhysicsWorld/.ctor): Create a new physics world. You should only do this if you want to simulate an extra world for some reason.

## Properties

- [`AirDensity`](/api/Sandbox.PhysicsWorld/AirDensity): Air density of this physics world, for things like air drag.
- [`Bodies`](/api/Sandbox.PhysicsWorld/Bodies): All bodies in the world
- [`Body`](/api/Sandbox.PhysicsWorld/Body): The body of this physics world.
- [`CollisionRules`](/api/Sandbox.PhysicsWorld/CollisionRules): Set or retrieve the collision rules for this [Sandbox.PhysicsWorld](/api/Sandbox.PhysicsWorld).
- [`DebugSceneWorld`](/api/Sandbox.PhysicsWorld/DebugSceneWorld): A SceneWorld where debug SceneObjects exist.
- [`Gravity`](/api/Sandbox.PhysicsWorld/Gravity): Access the world's current gravity.
- [`Group`](/api/Sandbox.PhysicsWorld/Group): The physics group of this physics world. A physics world will contain only 1 body.
- [`PositionIterations`](/api/Sandbox.PhysicsWorld/PositionIterations)
- [`SimulationMode`](/api/Sandbox.PhysicsWorld/SimulationMode): Physics simulation mode. See [Sandbox.PhysicsSimulationMode](/api/Sandbox.PhysicsSimulationMode) for explanation of each mode.
- [`SleepingEnabled`](/api/Sandbox.PhysicsWorld/SleepingEnabled): If true then bodies will be able to sleep after a period of inactivity
- [`SubSteps`](/api/Sandbox.PhysicsWorld/SubSteps): If you're seeing objects go through other objects or you have a low tickrate, you might want to increase the number of physics substeps. This breaks physics steps down into this many substeps. The default is 1 and works pretty good. Be aware that the number of physics ticks per second is going to be tickrate * substeps. So if you're ticking at 90 and you have SubSteps set to 1000 then you're going to do 90,000 steps per second. So be careful here.
- [`TimeScale`](/api/Sandbox.PhysicsWorld/TimeScale)
- [`Trace`](/api/Sandbox.PhysicsWorld/Trace): Raytrace against this world
- [`VelocityIterations`](/api/Sandbox.PhysicsWorld/VelocityIterations)

## Methods

- [`DebugDraw`](/api/Sandbox.PhysicsWorld/DebugDraw): Draws the physics debug overlays enabled via the physics_debug_draw convars, updating the SceneObjects in the [Sandbox.PhysicsWorld.DebugSceneWorld](/api/Sandbox.PhysicsWorld/DebugSceneWorld). Call once per tick or frame.
- [`Delete`](/api/Sandbox.PhysicsWorld/Delete): Delete this world and all objects inside. Will throw an exception if you try to delete a world that you didn't manually create.
- [`GetCollisionRule`](/api/Sandbox.PhysicsWorld/GetCollisionRule): Gets the specific collision rule for a pair of tags.
- [`RunTrace`](/api/Sandbox.PhysicsWorld/RunTrace): Like calling PhysicsTraceBuilder.Run, except will re-target this world if it's not already the target
- [`RunTraceAll`](/api/Sandbox.PhysicsWorld/RunTraceAll): Like calling PhysicsTraceBuilder.RunAll, except will re-target this world if it's not already the target
- [`SetCollisionRules`](/api/Sandbox.PhysicsWorld/SetCollisionRules): Used internally to set collision rules from gamemode's project settings. You shouldn't need to call this yourself.
- [`SetupPhysicsFromModel`](/api/Sandbox.PhysicsWorld/SetupPhysicsFromModel): Temp function for creating model physics until entity system handles it
- [`Step`](/api/Sandbox.PhysicsWorld/Step): Step simulation of this physics world. You can only do this on physics worlds that you manually create.
