Skip to content

PhysicsAPI reference

Class PhysicsSystem

Namespace: MicroEngine.Physics
Assembly: MicroEngine.Physics.dll
Guide: Physics worlds

Steps physics worlds, each optionally bound to the scene world whose entities own its bodies. A bound physics world steps only in the engine steps its scene world stepped in, by that world’s scaled step (Delta), so a paused, frozen or covered scene’s physics stands still too; after the step, the pose of every kinematic and dynamic body is written to its owner’s transform (WriteTransforms), which the scene world interpolates for drawing. An unbound world steps by the engine’s fixed step.

C#
public sealed class PhysicsSystem

Inheritance

object ← PhysicsSystem

Constructors

PhysicsSystem()

C#
public PhysicsSystem()

Properties

Count

How many physics worlds are registered.

C#
public int Count { get; }

Property Value

int

Methods

Add(IPhysicsWorld2D, SceneWorld?)

Registers physics, bound to world when given.

C#
public void Add(IPhysicsWorld2D physics, SceneWorld? world = null)

Parameters

physics IPhysicsWorld2D

world SceneWorld?

Exceptions

InvalidOperationException

It is already registered.

Remove(IPhysicsWorld2D)

Stops stepping physics; false when it was not registered.

C#
public bool Remove(IPhysicsWorld2D physics)

Parameters

physics IPhysicsWorld2D

Returns

bool

Run(FrameContext)

Steps every registered world for one fixed step of frame (what PhysicsModule schedules).

C#
public void Run(FrameContext frame)

Parameters

frame FrameContext