Client Rigidbody not working

I want to make player's ragdoll yoink when they are hit, but only the host ragdoll will apply the force when hit by an object but not the client, where did I do wrong? Can some one help me, thank you.
This is my code:

private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Dice")
        {
            isRagdoll = true;
            Vector3 force = other.GetComponent<Rigidbody>().velocity * hitForceMultiplier;
            spine.velocity = force;
            if (IsOwner)
            {
                ChangeRagdollStateClientRpc(isRagdoll);
                ChangeRagdollForceClientRpc(force);
            }

        }
    }

    [ClientRpc]
    void ChangeRagdollStateClientRpc(bool ragdollState)
    {
        isRagdoll = ragdollState;
    }
    [ClientRpc]
    void ChangeRagdollForceClientRpc(Vector3 force)
    {
        spine.velocity = force;
    }

I'm using a older Unity version 2022.3.35f1

If you want the spine.velocity synchronized between clients the object needs to have NetworkRigidbody and NetworkTransform components on it. You only need to apply the velocity on the host since the host simulates physics.


Thanks for the reply!
How can I do that exactly? Do I make it ChangeRagdollForceServerRpc? I'm new to unity netcode so I'm not sure what to do. I'm also using Client Network Transform by the way, will this affect anything?

Not sure about ClientNetworkTransform. This would authorize the client to change the transform however physics is server-side only, so this might be in conflict. I'm not aware but there might be a corresponding ClientNetworkRigidbody that you'd have to use in conjunction with it - or it may simply work by not using NetworkRigidbody, thus allowing the client to run its own physics simulation.

I haven't really used network physics because it's super-tricky to get right. I would recommend to make a simple test case with basic components as they are intended, eg server has full authority. Try with and without NetworkRigidbody to see how that affects behaviour of physics objects. For testing, disable any interpolation because you want to see the actual state of the objects.

Once that works correctly, no matter how badly it may lag or jerk, you can try and change it to make it client authoritative.

Sorry I can't provide more help. I have creating a networked physics example in my backlog but it'll be a while until I get to this.