Nebula
Containers

PhysicsFrame

A container's own physics frame: a local physics scene in which the container stands still (docs/container-tree.md §3).

generated from the sources
public sealed class PhysicsFrame

A container's own physics frame: a local physics scene in which the container stands still (docs/container-tree.md §3). Everything the container holds is parented under Root, so in simulation space (every worker, and a client while it predicts) positions inside the frame are container-local and "down" is the container's own down.

Properties

Owner

public Container Owner { get; }

The container that owns this frame.

Root

public Transform Root { get; }

The frame root: every entity and fixed child container inside the frame hangs under it.

Scene

public Scene Scene { get; }

The Unity scene the frame simulates in; invalid in the Editor outside play mode without a test scene factory.

PhysicsScene

public PhysicsScene PhysicsScene { get; }

The frame's physics scene: where queries about anything inside the frame belong.

State

public PhysicsFrameState State { get; }

The frame's motion this tick (D14).

HasPoseOwner

public bool HasPoseOwner { get; }

The frame's pose is driven by an entity (its carrier), so only that entity's authority knows it exactly (D15).

Origin

public Vector3 Origin { get; }

The frame's floating origin (docs/container-tree.md D19): the frame-local point that sits at Unity's origin in simulation space. Zero until the worker moves it with PhysicsFrames.ShiftOrigin; a planet's frame is large, and physics a few thousand kilometres from Unity's origin would be imprecise. A client keeps one too, near what it predicts in the frame, by the same rule (PhysicsFrames.BeginSimulation).

KeepOriginLevel

public bool KeepOriginLevel { get; set; }

The worker's automatic origin shifts (PhysicsFrames.AutoShift) move this frame's origin across, never up or down. Set by a planar chunk grid hosted in the frame (docs/container-tree.md D22), whose columns, like a planar root grid's, never shift vertically; a game may set it for a frame of its own. PhysicsFrames.ShiftOrigin called directly still moves the origin wherever it is told.

UseRenderOrigin

public bool UseRenderOrigin { get; set; } = true;

Whether this frame may be drawn about a render origin near the camera (D25). On by default; a game turns it off for a frame it poses itself. A frame whose content stays near its own origin (a ship's) never uses one whatever this says, as long as the anchor stays within PhysicsFrames.RenderOriginThreshold.

RenderOrigin

public Vector3 RenderOrigin { get; }

The frame-local point the frame is drawn about on a rendering client (D25): zero while the render anchor is near the frame's own origin, else the anchor's frame-local position snapped to PhysicsFrames.RenderOriginStep. Always zero on a worker.

RenderPosition

public Vector3 RenderPosition { get; }

Where the frame is drawn: its carrier's position as PhysicsFrames.PoseForRender last posed it (on a worker, and before the first pose, the carrier's current one). Read this rather than Root.position, which under a render origin is composed in float through the turned origin.

RenderRotation

public Quaternion RenderRotation { get; }

The frame's orientation as drawn (see RenderPosition).

RenderScale

public Vector3 RenderScale { get; }

The frame's scale as drawn (see RenderPosition): the carrier's lossy scale, normally one.

Events

Shifted

public event Action<Vector3> Shifted;

Raised after this frame's origin moved: the delta every cached simulation-space position of this frame gets (pose history, interpolation buffers and game caches are moved by Nebula for its own entities).

Methods

LocalToSimulation

public Vector3 LocalToSimulation(Vector3 local);

A frame-local position (container-local) where it sits in simulation space right now.

SimulationToLocal

public Vector3 SimulationToLocal(Vector3 position);

A simulation-space position inside this frame as a frame-local (container-local) one.

LocalToRender

public Vector3 LocalToRender(Vector3 local);
public Quaternion LocalToRender(Quaternion local);

A frame-local point where it is drawn: RenderPosition + RenderRotation × (RenderScale ∘ local), composed in double, so a point 200 km from the frame's origin but near the camera comes out within a fraction of a millimetre.

LocalToRenderPrecise

public Double3 LocalToRenderPrecise(Double3 local);

LocalToRender from and to double.

RenderToLocalPrecise

public Double3 RenderToLocalPrecise(Double3 scene);

A point of the drawn scene in frame-local coordinates, in double (LocalToRender's inverse).

RenderToLocal

public Vector3 RenderToLocal(Vector3 scene);
public Quaternion RenderToLocal(Quaternion scene);

RenderToLocalPrecise for a float scene point.

ToParent

public Vector3 ToParent(Vector3 local);
public Quaternion ToParent(Quaternion local);

A frame-local point in the space around the frame, from the owner's current transform.

FromParent

public Vector3 FromParent(Vector3 parent);
public Quaternion FromParent(Quaternion parent);

A point of the space around the frame in frame-local coordinates.

ToString

public override string ToString();

On this page