PhysicsWorldclass
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.
Constructors1
Showing 1 constructors
public PhysicsWorld()
Creates a new 3D physics world.
No results match this filter.
Methods16
Showing 16 methods
public static Sandbox.PhysicsWorld Create()
Creates a new 3D physics world.
Obsolete: Use new PhysicsWorld() instead
public Sandbox.PhysicsBody CreateBody()
Create a new physics body in this world.
public void DebugDraw()
Updates all the SceneObjects in the `Sandbox.PhysicsWorld.DebugSceneWorld`, call once per tick or frame.
void—public void 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.
void—public Sandbox.Physics.CollisionRules.Result GetCollisionRule(string left, string right)
Gets the specific collision rule for a pair of tags.
| Parameter | Type | Description |
|---|---|---|
| left | string | — |
| right | string | — |
public Sandbox.PhysicsTraceResult RunTrace(Sandbox.PhysicsTraceBuilder trace)
Like calling PhysicsTraceBuilder.Run, except will re-target this world if it's not already the target
| Parameter | Type | Description |
|---|---|---|
| trace | PhysicsTraceBuilder | — |
public Sandbox.PhysicsTraceResult[] RunTraceAll(Sandbox.PhysicsTraceBuilder trace)
Like calling PhysicsTraceBuilder.RunAll, except will re-target this world if it's not already the target
| Parameter | Type | Description |
|---|---|---|
| trace | PhysicsTraceBuilder | — |
public void SetCollisionRules(Sandbox.Physics.CollisionRules rules)
Used internally to set collision rules from gamemode's project settings. You shouldn't need to call this yourself.
Obsolete: Use CollisionRules Property
| Parameter | Type | Description |
|---|---|---|
| rules | CollisionRules | — |
void—No results match this filter.
Properties15
Showing 15 properties
public float Sandbox.PhysicsWorld.AirDensity { get; set; }
Air density of this physics world, for things like air drag.
float—public System.Collections.Generic.IEnumerable`1<Sandbox.PhysicsBody> Sandbox.PhysicsWorld.Bodies { get; set; }
All bodies in the world
public Sandbox.PhysicsBody Sandbox.PhysicsWorld.Body { get; set; }
The world's static reference body, used as a default anchor for joints.
public Sandbox.Physics.CollisionRules Sandbox.PhysicsWorld.CollisionRules { get; set; }
Set or retrieve the collision rules for this `Sandbox.PhysicsWorld`.
public Sandbox.SceneWorld Sandbox.PhysicsWorld.DebugSceneWorld { get; set; }
A SceneWorld where debug SceneObjects exist.
public Vector3 Sandbox.PhysicsWorld.Gravity { get; set; }
Access the world's current gravity.
public Sandbox.PhysicsGroup Sandbox.PhysicsWorld.Group { get; set; }
The physics group of this physics world. A physics world will contain only 1 body.
public virtual sealed bool Sandbox.PhysicsWorld.IsValid { get; set; }
bool—public int Sandbox.PhysicsWorld.PositionIterations { get; set; }
Obsolete: This API member is obsolete.
int—public Sandbox.PhysicsSimulationMode Sandbox.PhysicsWorld.SimulationMode { get; set; }
Physics simulation mode. See `Sandbox.PhysicsSimulationMode` for explanation of each mode.
public bool Sandbox.PhysicsWorld.SleepingEnabled { get; set; }
If true then bodies will be able to sleep after a period of inactivity
bool—public int Sandbox.PhysicsWorld.SubSteps { get; set; }
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.
int—public float Sandbox.PhysicsWorld.TimeScale { get; set; }
Obsolete: This API member is obsolete.
float—public Sandbox.PhysicsTraceBuilder Sandbox.PhysicsWorld.Trace { get; set; }
Raytrace against this world
public int Sandbox.PhysicsWorld.VelocityIterations { get; set; }
Obsolete: This API member is obsolete.
int—No results match this filter.