Vixen
02b45cc4
csharp
public sealed class PhysicsWorld

A simulated world: bodies, constraints, characters and the queries that ask about them.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

This is the whole engine-facing surface of Jolt. Nothing above it names a Jolt type, which is what makes the binding replaceable and what lets the API be shaped for Vixen's conventions — right-handed Y-up mathematics, handles rather than native objects, a fixed step it does not own.

It does not own the clock. Step takes a delta and does not accumulate, because the accumulator is Vixen.Engine.Frames.FixedStepAccumulator and there must be exactly one of it — a physics world that ran its own steps would drift from the simulation phase it is meant to be part of, and a replay would stop reproducing.

It is not thread-safe. Bodies are created, moved and queried from whichever thread drives the step, and Jolt's own parallelism lives inside Step. The one exception is the contact callbacks, which Jolt raises from its job threads; those are buffered under a lock and handed back on the calling thread once the step is over — see Contacts.

Fields and properties (16)

  • public int CharacterCount

    How many character controllers this world has.

  • public ReadOnlySpan<ConstraintHandle> ConstraintHandles

    Every constraint in the world, in the order it was created.

  • public PhysicsShapes Shapes

    The shapes bodies in this world may use.

  • public PhysicsLayers Layers

    The layer table this world was built with.

  • public PhysicsWorldSettings Settings

    How the world was configured.

  • public Vector3 Gravity

    Gravity, in metres a second squared.

  • public int BodyCount

    How many bodies exist, awake or asleep.

  • public int ActiveBodyCount

    How many bodies are awake and being solved.

  • public int ConstraintCount

    How many constraints exist.

  • public long StepCount

    How many steps have been run.

  • public PhysicsStepResult LastStepResult

    What the last step ran into.

  • public bool IsDisposed

    Whether Dispose has been called.

  • public ReadOnlySpan<ContactEvent> Contacts

    Everything that touched, went on touching or stopped during the last step.

  • public ReadOnlySpan<TriggerEvent> Triggers

    Everything that entered or left a sensor during the last step.

  • public ReadOnlySpan<BodyHandle> Activations

    Bodies that woke during the last step.

  • public ReadOnlySpan<BodyHandle> Deactivations

    Bodies that fell asleep during the last step.

Methods (54)

Used by (19)

  • ArenaCameraOcclusionThirdPersonShooter
  • WeaponFireThirdPersonShooter
  • CharacterControllerVixen.Physics
  • CharacterControllerTestsVixen.Physics.Tests
  • HeightFieldShapeTestsVixen.Physics.Tests
  • JoltMathTestsVixen.Physics.Tests
  • LagCompensationTestsVixen.Net.Physics.Tests
  • LagCompensatorVixen.Net.Physics
  • PhysicsConstraintTestsVixen.Physics.Tests
  • PhysicsDebugDrawVixen.Physics
  • PhysicsDeterminismTestsVixen.Physics.Tests
  • PhysicsLayerTestsVixen.Physics.Tests
  • PhysicsOcclusionProviderVixen.Audio.Physics
  • PhysicsOcclusionTestsVixen.Audio.Physics.Tests
  • PhysicsQueryTestsVixen.Physics.Tests
  • PhysicsSceneVixen.Physics
  • PhysicsSceneTestsVixen.Physics.Tests
  • PhysicsShapeTestsVixen.Physics.Tests
  • PhysicsWorldTestsVixen.Physics.Tests