Search Unity

NetworkTransformVisualizer

Discussion in 'Multiplayer' started by moco2k, Oct 3, 2015.

  1. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Hey,

    I am wondering how to properly use NetworkTransformVisualizer.
    The docs are currently lacking on this component.

    When I just add a NetworkTransformVisualizer component to a networked game object with a NetworkTransform (SyncTransform mode) and set up a visualizer prefab, the prefab is always spawned at (0,0,0) and does not change at all.

    Any help is much appreciated.
     
  2. Capn_Andy

    Capn_Andy

    Joined:
    Nov 20, 2013
    Posts:
    80
    I've only had luck making it work in "Transform" sync mode, not rigidbody. Try popping it over to that and see if it does the trick for you.
     
  3. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    It only appears to work on the clients. Host/Server the they do seem to stay at locked at 0,0,0.
     
  4. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    the NetworkTransformVisualizer only moves if the object it is attached to is not the authority. For the authoritative object (such as the local player on the host) there is no interpolation to show..
     
  5. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Hmm, the visualizer still does not move properly, even on a client. I do not know if this makes a difference, but I use the NetworkTransform on an NPC character. The NPC movement is controlled on the server by NavMeshAgent and I want the movement to be smoothly interpolated on the clients. The setup of NetworkTransform is as shown in the attached screenshot.
     

    Attached Files:

  6. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    You need to be using Rigidbody sync to get interpolation.

    @seanr I got this for NPC objects on host as well. I had them on AI bots and NTV would stay at 0,0,0 when running on the host but worked ask expected on clients.
     
  7. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    OK, when I switch to Sync Rigidbody 3D, at least the visualizer works properly.
    Unfortunately, however, the network transform itself does not work any longer. There is no smooth movement on the client any more. Instead, on the client, the NPC just snaps through the level so it seems that it is exclusively moved by the snap threshold.

    What's going on here?

    And why does interpolation do not work for SyncTransform as well?
     
    Last edited: Oct 12, 2015
  8. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Make sure IsKinematic is not checked on your rigidbody. Also that you don't apply changes to movement outside of FixedUpdate and only update on the server.
     
  9. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Thanks for your advice. But is this solution still compatible with moving the NPCs by NavMeshAgent pathfinding? I will try ofc.