Search Unity

VR Controller movement is syncing / moving

Discussion in 'Netcode for GameObjects' started by OvrSimon, Sep 8, 2022.

  1. OvrSimon

    OvrSimon

    Joined:
    Nov 16, 2021
    Posts:
    2
    Hello fellow forum devs!

    I am a virtual reality developer working on a fitness boxing game for the Meta Quest. I want to incorporate a multiplayer mode into the game that players can compete and train with others in the game, and I am using netcode in hopes to accomplish this.

    I have run into an issue where the player GameObjects are not moving accurately to match the speed of the player's controllers. Attached I have 2 videos of a guy throwing quick punches viewed from the server and the client side games. Note that on the client side, the punches do not even travel the full distance the hand actually went out.

    Turning off networkTransform interpolation does not fix the issue, and it adds a lot of jagged movement to the hands of the player. Is there something I may be overlooking? If possible I would appreciate it if someone could steer me in the right direction.
     

    Attached Files:

  2. CosmoM

    CosmoM

    Joined:
    Oct 31, 2015
    Posts:
    204
    Every tick, the NetworkTransform sends a transform update. However, if movement goes back and forth, like with punches, then it may well be that for update A the arm is still moving forward, while for update B it's already on its way back. Interpolation will not help or hinder in that case, because there is simply data missing in between (e.g. the endpoint of the punch). So you need to fill in that data somehow. The simplest thing would be to increase the tick rate in the NetworkManager: more network traffic, but a higher time resolution for movement. Alternatively, use custom messages to send the most important transform points yourself; for example, detect the end point of a punch and use that for interpolating the transform on the client side.