The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Problem with syncing child object rotations

Crushl
2022-06-06 19:36:36

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.

Comments

Crushl
2022-06-08 21:32:18

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

Looking really good now 😊

elgun_jumayev
2022-07-07 08:37:59

Crushl 2022-06-08T21:32:18+00:00

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

Looking really good now 😊

Could you share your custom sync script. I am new to Fusion and try to understand Fusion's custom synchronization. Thanks in advance.

Back to top