Search Unity

UNET Rigidbody Network Transform not updating correctly

Discussion in 'UNet' started by ScottRichards, May 26, 2017.

  1. ScottRichards

    ScottRichards

    Joined:
    Oct 20, 2016
    Posts:
    24
    Hello, I am trying to send a rigidbody across the network using the default sync rigidbody 3D values. The rigidbody is on the parent object which is empty, minus a collider and the script to apply force to it. The child obejct contains its mesh. When I move the rigidbody locally, the client that is viewing doesn't see the movement, instead, every 5 seconds, the rigidbody jumps to its new position, so some information is getting sent. Because the child contains the actual mesh of the rigidbody, I thought perhaps I needed to add a Network Transform Child script. Doing this didn't change anything, even when the child and its mesh was correctly assigned. The child actually never moves, its position and rotation is defined by the parent, so it seems odd to think that I would need this script. Does anyone know why I am not getting a smooth update, and instead the character is moving in clips / teleporting to its current position every 5 or so seconds? The network transform that I have on it is as follows.

    Sync Rigidbody 3d
    Send rate 16
    Move Threshold 0.001
    Vel Threshold 0.0001
    Snap Threshold 5
    Interopolate Mov Factor 1
    Rotation Axis Full 3D
    Interpolate Rot Factor 1
    Compress Rot None
    Sync Angular Velocity Checked

    Thank you in advanced for any help that you may be able to provide into this matter!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    How are you moving the object locally though? I don't believe just updating its x/y/z position will properly update using a Network Transform, which I suspect is what you're doing. Try applying a force to the object instead.

    Also, experiment with setting a much higher Snap Threshold. Snap Threshold is the distance where it will no longer attempt to smooth between and instead "snap" to position. The way I think of that is the distance at which you're hopelessly out of position and accept you're going to have the client see bad teleporting for the sake of getting the object into the correct position. What to set it to depends on what your object is, its size, and how fast it moves, but I'd start somewhere around 100. In normal testing on a local network you want to never hit the Snap Threshold unless you're doing some high latency network simulations.

    As far as Network Transform Child, I've only needed to use that when the child object is making a separate movement from the parent. For example a tank with a rotating turret would probably use one. I use one in my sailing ship game so the child ship object can rock back and forth a bit to give some realism while not rocking the position of the parent player object.

    As far as your issue, my guess is you're moving the object in a manner that Network Transform doesn't send properly, like just updating position, and then once you pass the Snap Threshold it is just snapping.
     
    Last edited: May 26, 2017