Nebula
Core

NetworkTransform

Replicates selected position, rotation, and scale axes from the authoritative worker to clients and ghost workers.

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

Replicates selected position, rotation, and scale axes from the authoritative worker to clients and ghost workers. Configure change thresholds, transform space, authority, interpolation, compression, and delivery mode in the Inspector.

Add this component to each transform that should move on remote copies. Without it, an identity only synchronizes its initial placement and container changes. Root updates use the batched spatial stream; child updates use component state. Both honor the selected axes, thresholds, and interpolation settings.

Nebula does not provide TickSyncChildren or SwitchTransformSpaceWhenParented. It sends every behaviour's state in the same entity update. An entity changes its parent only when it changes containers.

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;

SyncScaleY

public bool SyncScaleY;

SyncScaleZ

public bool SyncScaleZ;

SyncVelocity

public bool SyncVelocity = true;

Include world-space motion velocity for remote extrapolation. Disable for objects that only interpolate.

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 = true;

Send ordinary updates unreliable-sequenced. Root transforms send reliable recovery within 30 ticks of movement; children send periodic keyframes. Off: 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.

SyncAngularVelocity

public bool SyncAngularVelocity = true;

Root only: send the angular velocity (derived from the rotation's change between updates) so remote copies keep turning between updates and when an update is late.

PreciseRotation

public bool PreciseRotation = true;

Root only, with quaternion compression: 15 bits per smallest-three component (6 bytes, about 0.005 degrees) instead of 10 (4 bytes, about 0.16 degrees). Clients older than protocol 30 receive 10 bits.

Interpolate

public bool Interpolate = true;

VelocityAwareInterpolation

public bool VelocityAwareInterpolation = true;

Root only: between two buffered updates, follow a curve through their velocities (cubic Hermite) instead of a straight line, and turn through their angular velocities. Falls back to a straight line when the velocities do not explain the move (a teleport, a collision).

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.

SettleTicks

public const uint SettleTicks = NetworkIdentity.SyncKeyframeInterval;

Ticks without a change after which the root sends one reliable entry with where it came to rest (docs/server-owned-entities.md D2). Every change pushes it back, so an entity that keeps moving sends none: its unreliable entries follow one another, and it is only the last one, which nothing would resend, that has to arrive.

Properties

Velocity

public Vector3 Velocity { get; set; }

IsRoot

public bool IsRoot { get; }

This component sits on the entity root and uses the batched spatial stream.

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();

WriteHandoverState

public override void WriteHandoverState(NetworkWriter writer);

ReadHandoverState

public override void ReadHandoverState(NetworkReader reader);

OnOriginShifted

public override void OnOriginShifted(Vector3 delta);

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

Lists the supported interpolation mode values.

Members

NameValueDescription
Buffered0Buffers states by tick and interpolates them at NetworkTime.RenderTick.
SmoothDamp1Moves smoothly toward the newest received state without buffering by tick.

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