Problem with syncing child object rotations

Options

Hey guys,

I'm new to networking, so this might be a very trivial / basic thing. I have been building a racing game and wanted to try to add a multiplayer mode using fusion.

My vehicle controller and the hirarchy differ substantially from the kart example, so I wasn't able to simply copy that (biggest difference: the car body is in a child object. While the main object has the rigidbody with position and velocity, the child object is rotating while the main object stays on 0 rotation).

What I did:

  • I set up the game with server / client to test: AutoHostOrClient
  • Players are set up on OnPlayerJoined, including identification of the server
  • Capturing inputs on Fusions OnInput and sending it to the Network with input.Set() and then capturing it in the FixedUpdateNetwork() with GetInput()

I didn't add much more (Runner, NetworkObjects, NetworkPlayer) and that worked as far as it should: Inputs were sent and the cars behaved as they should, but without having a synchronized position / rotation (only Inputs were sent, so I saw them on different positions on each client).

To fix that, I added a Network Rigidbody to the main car object and that fixed the problem on the Server. On the Server every car (network and local) behaved as it should, including position and rotation.

On the clients, all cars stopped rotating completly (they also no longer had any effects like skidmarks or other visual effects). The position however is updated correctly.

I tried putting Networked variables on Object Scripts (on those rotating like the car body and the wheels) but I think I did that wrong since it either ended in stuttering objects or something like the network state was fighting the inputs.

I basicly need the cars to do on clients what they do on the server already.

If someone could give me a hint on how to do this properly, I would greatly appreciate it.

Best Answer

  • Crushl
    Crushl
    Answer ✓
    Options

    Fixed it. Had to remove the Network Rigidbody and create my own sync values.


    Looking really good now 😊

Answers