Table of Contents

Constructor PhysicsWorld

Namespace
Box3D
Assembly
Box3D.NET.dll

PhysicsWorld()

Creates a world with the engine's default settings.

public PhysicsWorld()

PhysicsWorld(WorldSettings)

Creates a world with the given settings.

public PhysicsWorld(WorldSettings settings)

Parameters

settings WorldSettings

The tuning to apply.

Remarks

Safe to call from several threads at once: construction and Box3D.PhysicsWorld.Dispose are serialised process-wide, because the engine's table of worlds is global and unsynchronised. Everything else about a world remains single-threaded; see the type documentation.

Exceptions

InvalidOperationException

The engine refused to create the world, which happens when Box3D.PhysicsWorld.MaxCount are already live.

PhysicsWorld(WorldSettings, IDebugShapeFactory?)

Creates a world that can draw its shapes, given something to build the drawables with.

public PhysicsWorld(WorldSettings settings, IDebugShapeFactory? shapeFactory)

Parameters

settings WorldSettings

The tuning to apply.

shapeFactory IDebugShapeFactory?

Builds and releases the drawable for each shape, or null for a world whose shapes are never drawn.

Remarks

The factory belongs here and not on Box3D.WorldSettings for two reasons. Box3D takes these callbacks in the world definition, so they genuinely cannot be supplied after the world exists. And Box3D.WorldSettings is a value type compared field by field; putting a reference in it would mean two settings that describe the same simulation stopped comparing equal because they named different factories.

The factory is kept alive for as long as the world, and released once the world has been destroyed.

Exceptions

InvalidOperationException

The engine refused to create the world, which happens when Box3D.PhysicsWorld.MaxCount are already live.