🐾PurrNet Docs
Plug & Play

Network Rigidbody

NetworkRigidbody synchronises physics state — position, rotation, velocity, and angular velocity — so remote Rigidbodies behave physically on every client, not just snap to transform positions.

NetworkRigidbody vs NetworkTransform

NetworkTransform synchronises the raw transform values (position and rotation). This works well for kinematic or character-controller driven objects, but for physics-simulated objects it ignores velocity — meaning remote bodies stop dead between snapshots and miss bounces, tumbles, or collisions.

NetworkRigidbodysynchronises the full physics state. Remote clients apply the received velocity to their local Rigidbody, so Unity's physics engine continues the simulation between packets. The object bounces, rolls, and spins naturally even under high latency.

Inspector settings

ParameterTypeDefaultDescription
Sync VelocitybooltrueReplicate the Rigidbody's linear velocity so remote bodies continue moving smoothly between snapshots.
Sync Angular VelocitybooltrueReplicate rotational velocity. Disable for objects that should not spin (e.g. capsule characters).
Interpolation ModeInterpolationModeInterpolateHow remote bodies are smoothed: Interpolate (smooth), Extrapolate (low-latency but can overshoot), or None (snap).
Owner AuthbooltrueOwner sends physics state updates. Set to false to make the server the sole physics authority.
Send Interval (ticks)int1Ticks between physics state snapshots. Higher values reduce bandwidth but increase interpolation error.
Position Tolerancefloat0.01Minimum position delta (metres) before a new snapshot is sent. Prevents spam when the object is at rest.

Owner-driven forces

The owner of an object applies forces or impulses to their local Rigidbody, and NetworkRigidbody broadcasts the resulting physics state to all clients. Never apply forces on non-authority clients — those bodies are being driven by received state.

ThrowableObject.cs
using PurrNet;
using UnityEngine;

[RequireComponent(typeof(NetworkRigidbody))]
public class ThrowableObject : NetworkBehaviour
{
    [SerializeField] private Rigidbody _rb;

    // Server spawns the object and grants ownership to the thrower
    [ServerRpc(requireOwnership: false)]
    public void CmdThrow(Vector3 force, Vector3 torque, RPCInfo info = default)
    {
        if (!info.asServer) return;

        // Give ownership to the client who threw it so they drive physics
        GiveOwnership(info.sender);
        ApplyForceOwner(force, torque);
    }

    // Runs on the new owner after CmdThrow transfers ownership
    [ObserversRpc(runLocally: true)]
    private void ApplyForceOwner(Vector3 force, Vector3 torque)
    {
        if (!isOwner) return;

        _rb.AddForce(force, ForceMode.Impulse);
        _rb.AddTorque(torque, ForceMode.Impulse);
    }

    // Only the authority should do physics work
    private void OnCollisionEnter(Collision col)
    {
        if (!isOwner && !isServer) return;
        // Handle bounce, damage, etc.
    }
}

Situational example — networked grenade

A grenade is spawned by the server, ownership transferred to the throwing client so they drive the physics. All clients see it tumble and bounce accurately. When it explodes (server-side), ownership returns to null.

Grenade.cs
using PurrNet;
using UnityEngine;
using System.Collections;

[RequireComponent(typeof(NetworkRigidbody))]
public class Grenade : NetworkBehaviour
{
    [SerializeField] private Rigidbody _rb;
    [SerializeField] private float     _fuseTime    = 3f;
    [SerializeField] private float     _blastRadius = 8f;
    [SerializeField] private int       _damage      = 80;

    protected override void OnSpawned()
    {
        if (isServer) StartCoroutine(FuseCoroutine());
    }

    // Called by the server after granting ownership to the thrower
    public void Launch(Vector3 velocity)
    {
        if (!isOwner) return;
        _rb.linearVelocity = velocity;
        _rb.AddTorque(Random.insideUnitSphere * 5f, ForceMode.Impulse);
    }

    private IEnumerator FuseCoroutine()
    {
        yield return new WaitForSeconds(_fuseTime);
        Explode();
    }

    [Server]
    private void Explode()
    {
        Collider[] hits = Physics.OverlapSphere(transform.position, _blastRadius);
        foreach (var hit in hits)
        {
            if (hit.TryGetComponent<HealthModule>(out var health))
            {
                float dist    = Vector3.Distance(transform.position, hit.transform.position);
                float falloff = 1f - (dist / _blastRadius);
                health.TakeDamage(Mathf.RoundToInt(_damage * falloff));
            }
        }

        RpcExplodeEffect();
        networkManager.Despawn(gameObject);
    }

    [ObserversRpc]
    private void RpcExplodeEffect()
    {
        ExplosionPool.Spawn(transform.position);
    }
}

Kinematic Rigidbodies

If the Rigidbody is set to isKinematic = true, Unity ignores velocity — use NetworkTransform instead. NetworkRigidbody only makes sense for non-kinematic bodies where you want the remote physics simulation to continue between snapshots.

Apply forces on owner or server, never on remote clients

If you call AddForce() on a non-authority client, the next incoming snapshot will immediately override it, causing a visual jerk. Always guard physics mutations with if (isOwner) or if (isServer).

Sleeping Rigidbodies

NetworkRigidbody automatically stops sending snapshots when the Rigidbody enters sleep mode (velocity below Unity's sleep threshold). This saves bandwidth for stacks of crates or scattered debris once they settle. Waking the body — via a collision or force — resumes syncing.