Nebula
Core

NetworkRigidbody

Puts a Unity Rigidbody under the mesh's authority model.

generated from the sources
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(NetworkTransform))]
[DisallowMultipleComponent]
public sealed class NetworkRigidbody : NetworkBehaviour

Puts a Unity Rigidbody under the mesh's authority model. On the worker that owns the entity the body is dynamic and PhysX simulates it; everywhere else (ghosts on neighbouring workers, every client) it is kinematic and follows the owner's state stream. Linear velocity is mirrored into NetworkIdentity.Motion every tick so remote copies extrapolate and a handover keeps momentum; angular velocity only matters to the next simulating worker, so it travels with the handover alone through NetworkBehaviour.WriteHandoverState. Add it next to the NetworkIdentity of any physics prop.

Properties

Body

public Rigidbody Body { get; }

Simulate

public bool Simulate { get; set; }

The game's say in whether the authoritative body is handed to the solver: clear it while the ground under the prop is not streamed in, or for a prop that is not physical right now. Local to this process and not carried by a handover - each owner decides for itself. The body's own kinematic flag is kept underneath and comes back when the gate opens.

Methods

OnNetworkSpawn

public override void OnNetworkSpawn();

OnGainedAuthority

public override void OnGainedAuthority();

OnLostAuthority

public override void OnLostAuthority();

NetworkTick

public override void NetworkTick(uint tick, float deltaTime);

WriteHandoverState

public override void WriteHandoverState(NetworkWriter writer);

ReadHandoverState

public override void ReadHandoverState(NetworkReader reader);

SetVelocity

public void SetVelocity(Vector3 linear, Vector3 angular = default);

Authority only: set the body's momentum (e.g. to launch a freshly spawned prop).

On this page