Nebula
Core

NetworkTransform

Replicates a Transform the way NGO's NetworkTransform does: per-axis position/rotation/scale selection, change thresholds, local or world space, server or owner authority, buffered tick interpolation or smooth damping on the receiving si...

generated from the sources
[DisallowMultipleComponent]
public class NetworkTransform : NetworkSyncBehaviour

Replicates a Transform the way NGO's NetworkTransform does: per-axis position/rotation/scale selection, change thresholds, local or world space, server or owner authority, buffered tick interpolation or smooth damping on the receiving side, teleport, half-float and smallest-three quaternion compression, and reliable deltas or unreliable deltas healed by keyframes.

The entity root is a special case in Nebula: its position, rotation and velocity already ride the identity's world-state stream at full rate to every ghost and client, so a NetworkTransform on the root does not send them again. On the root it adds scale, Teleport (which snaps the identity interpolator too) and owner authority (the owner's pose travels to the worker here, then to everyone through the identity stream). On any child transform (turret, door, held item) it replicates everything selected.

NGO options with no counterpart here: TickSyncChildren (every behaviour's chunk already rides the same per-entity per-tick message) and SwitchTransformSpaceWhenParented (an entity's parent only changes when its container changes, and world-space values are carried in container space on the wire and resolved with the container index of the same tick).

Fields

SyncPositionX

public bool SyncPositionX = true;

SyncPositionY

public bool SyncPositionY = true;

SyncPositionZ

public bool SyncPositionZ = true;

SyncRotAngleX

public bool SyncRotAngleX = true;

SyncRotAngleY

public bool SyncRotAngleY = true;

SyncRotAngleZ

public bool SyncRotAngleZ = true;

SyncScaleX

public bool SyncScaleX = true;

SyncScaleY

public bool SyncScaleY = true;

SyncScaleZ

public bool SyncScaleZ = true;

PositionThreshold

public float PositionThreshold = 0.001f;

Metres the position must move before an update is sent.

RotAngleThreshold

public float RotAngleThreshold = 0.01f;

Degrees the rotation must change before an update is sent.

ScaleThreshold

public float ScaleThreshold = 0.01f;

InLocalSpace

public bool InLocalSpace;

Replicate localPosition/localRotation (relative to the parent) instead of world position/rotation. Scale is always local.

UseUnreliableDeltas

public bool UseUnreliableDeltas;

Send deltas unreliable-sequenced with a keyframe every NetworkIdentity.SyncKeyframeInterval ticks, instead of reliable-ordered.

UseHalfFloatPrecision

public bool UseHalfFloatPrecision;

Send positions, scales and (uncompressed) rotations as 16-bit halves.

UseQuaternionSynchronization

public bool UseQuaternionSynchronization;

Send the full quaternion instead of the selected Euler angles (no gimbal issues; all three axes always).

UseQuaternionCompression

public bool UseQuaternionCompression;

With quaternion synchronization: smallest-three compression, 4 bytes per rotation.

Interpolate

public bool Interpolate = true;

Interpolation

public InterpolationMode Interpolation = InterpolationMode.Buffered;

SlerpPosition

public bool SlerpPosition;

Spherically interpolate position between samples (curved paths, e.g. an orbiting object).

PositionMaxInterpolationTime

public float PositionMaxInterpolationTime = 0.1f;

Smooth damp only: seconds to reach the newest position.

RotationMaxInterpolationTime

public float RotationMaxInterpolationTime = 0.1f;

Smooth damp only: seconds to reach the newest rotation.

ScaleMaxInterpolationTime

public float ScaleMaxInterpolationTime = 0.1f;

Smooth damp only: seconds to reach the newest scale.

Properties

IsRoot

public bool IsRoot { get; }

This component sits on the entity root, whose position/rotation the identity stream already carries.

SyncDelivery

public override Delivery SyncDelivery { get; }

Methods

OnAuthorityPushTransformState

protected virtual void OnAuthorityPushTransformState(ref TransformState state);

Authority, just before a state is written. Modify it to send something other than the transform.

OnNetworkTransformStateUpdated

protected virtual void OnNetworkTransformStateUpdated(ref TransformState state);

Non-authoritative copies, after a received state was applied or buffered.

Teleport

public void Teleport(Vector3 position, Quaternion rotation, Vector3 scale);

Authority only: move instantly, and make every remote copy snap instead of interpolating.

SetState

public void SetState(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool teleport = true);

Authority only: set any of position/rotation/scale (in the configured space); null leaves a part alone.

OnNetworkSpawn

public override void OnNetworkSpawn();

OnGainedAuthority

public override void OnGainedAuthority();

OnLostAuthority

public override void OnLostAuthority();

AuthorityTick

protected override void AuthorityTick(uint tick, float deltaTime);

WriteSyncState

public override void WriteSyncState(NetworkWriter writer, bool full);

OnSyncStateSent

protected internal override void OnSyncStateSent();

ReadSyncState

public override void ReadSyncState(NetworkReader reader, uint tick, bool full);

ApplyOwnerState

protected override void ApplyOwnerState(NetworkReader reader, bool full);

RemoteTick

public override void RemoteTick(double renderTick);

Nested types

InterpolationMode

public enum InterpolationMode : byte

Members

NameValueDescription
Buffered0Tick-buffered interpolation at NetworkTime.RenderTick (NGO's Lerp / Legacy lerp): exact, a few ticks behind.
SmoothDamp1Smooth-damp towards the newest state (NGO's Smooth dampening): never behind, never exact.

TransformState

public struct TransformState

A replicated pose. Fields without their Has* flag were not part of the update.

Fields

Tick
public uint Tick;
Position
public Vector3 Position;
Rotation
public Quaternion Rotation;
Scale
public Vector3 Scale;
HasPosition, HasRotation, HasScale
public bool HasPosition, HasRotation, HasScale;
Teleport
public bool Teleport;
InLocalSpace
public bool InLocalSpace;

Position/rotation are expressed in the local (parent) space rather than world space.

On this page