Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Player prefab : sync child rigidbody

Discussion in 'Multiplayer' started by Razouille, Sep 15, 2015.

  1. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Hi everyone,

    I started to implement the networking system in my project, but i don't know how i can handle child rigidbodies. The NetworkTransform component only manages the parent object of the prefab (i added a NetworkTransform on both childs it doesn't change anything, maybe the childs have to be spawned on the network too ?). Actually the 5.2 update adds a "NetworkTransformChild" component but only sync transform position and rotation, no physic.

    Here is my prefab hierarchy :
    -Parent Object : no component, just here to regroup the 2 childrens
    --Body : contains a rigidbody with box collider, and the main script
    --Feet : contains a rigidbody with box collider and a spring joint connected to the Body

    Does anyone know how i can handle all my rigidbodies in order to have good sync of the entire object ? Or do i have to wait another Unity update, hoping they will do that ?
     
    MaxFrax96 likes this.
  2. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
  3. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Nope it's the case if the parent and the child have rigidbodies, in my hierarchy the parent object doesn't have anything, the two childrens move differently when the joint is disabled.

    Just for information, i checked the doc again (http://docs.unity3d.com/Manual/UNetSpawning.html) and find something to keep moving : "NetworkBehaviour scripts must be on the same game object as the NetworkIdentity, not on child game objects", so i put my script on the parent and removed NetworkIdentity on the Body. Now the two childrens work pretty well with the NetworkTransformChild component, so maybe i'll try to sync the velocity by myself.
     
  4. DeeCeptor

    DeeCeptor

    Joined:
    Aug 4, 2013
    Posts:
    31
    Did you ever find a solution for this problem? I find myself in the exact same situation. It'd be nice to use Unity's networking functions to handle the syncing of the child rigidbodies, instead of writing custom code.
     
  5. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Actually i'm currently using the plugin "Forge Networking" available on the Asset Store, they manage this situation.
    But you can use what i said : the NetworkTransformChild component, then write your own position lerp depending on current physic, maybe i will do that because physic sync is kinda mess :-/
     
  6. MaxFrax96

    MaxFrax96

    Joined:
    Nov 18, 2012
    Posts:
    11
    Has changed anything through the years?