Struct WorldReference
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
Identifies the world a body, shape or joint belongs to.
public readonly record struct WorldReference : IEquatable<WorldReference>Implements
Inherited Members
Examples
Rejecting a body that came from somewhere else:
if (body.World != world.Reference)
{
throw new ArgumentException("That body belongs to a different world.");
}
Remarks
This is not a Box3D.PhysicsWorld. Box3D can name the world that owns an object, but it cannot hand back the managed instance that wraps it, and inventing one would produce a second object claiming ownership of the same world and a second thing to dispose.
So this answers the question the engine can actually answer: which world is it. Compare it against another reference, or against Box3D.PhysicsWorld.Reference, to find out whether two objects belong to the same simulation.
Properties
- IsValid
-
Gets a value indicating whether the world is still alive.