class PhysicsWorld

in global :: Sandbox

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.


public IEnumerable<PhysicsBody> Bodies { get; }

All bodies in the world

public CollisionRules CollisionRules { get; set; }

Set or retrieve the collision rules for this .

public PhysicsGroup SetupPhysicsFromModel( Model model, PhysicsMotionType motionType )

Temp function for creating model physics until entity system handles it

public PhysicsGroup SetupPhysicsFromModel( Model model, Transform transform, PhysicsMotionType motionType )

Temp function for creating model physics until entity system handles it

public void Step( float delta )

Step simulation of this physics world. You can only do this on physics worlds that you manually create.

public void Step( float delta, int subSteps )

Step simulation of this physics world. You can only do this on physics worlds that you manually create.

public void Step( float worldTime, float delta, int subSteps )

Step simulation of this physics world. You can only do this on physics worlds that you manually create.

public SceneWorld DebugSceneWorld { get; set; }

A SceneWorld where debug SceneObjects exist.

public Vector3 Gravity { get; set; }

Access the world's current gravity.

public float AirDensity { get; set; }

Air density of this physics world, for things like air drag.

public PhysicsBody Body { get; }

The body of this physics world.

public PhysicsGroup Group { get; }

The physics group of this physics world. A physics world will contain only 1 body.

public bool SleepingEnabled { get; set; }

If true then bodies will be able to sleep after a period of inactivity

public PhysicsSimulationMode SimulationMode { get; set; }

Physics simulation mode. See for explanation of each mode.

public int PositionIterations { get; set; }

Used for constraints (joints). Higher values should result in more accurate simulation (TODO: Confirm this)

public int VelocityIterations { get; set; }

Used for constraints (joints). Higher values should result in more accurate simulation (TODO: Confirm this)

public int 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.

public void SetCollisionRules( CollisionRules rules )

Used internally to set collision rules from gamemode's project settings. You shouldn't need to call this yourself.

public CollisionRules.Result GetCollisionRule( string left, string right )

Gets the specific collision rule for a pair of tags.

public PhysicsTraceBuilder Trace { get; }

Raytrace against this world

public PhysicsTraceResult RunTrace( ref PhysicsTraceBuilder trace )

Like calling PhysicsTraceBuilder.Run, except will re-target this world if it's not already the target

public PhysicsTraceResult[] RunTraceAll( ref PhysicsTraceBuilder trace )

Like calling PhysicsTraceBuilder.RunAll, except will re-target this world if it's not already the target

public bool Equals( object obj )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public PhysicsWorld( )

😔 No documentation found.

public float TimeScale { get; set; }

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public void DebugDraw( )

😔 No documentation found.

public void Delete( )

😔 No documentation found.