How to correctly set up Network Transform/Network Rigidbody?

The whole answer can be found below.

Please note: 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! And we offer you support through 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.

How to correctly set up Network Transform/Network Rigidbody?

LususNaturae
2022-05-02 08:14:53

I'm sorry, this is probably a very basic question, but I don't seem to be able to figure it out on my own.

What do I have to do in order to correctly set up a Network Rigidbody?

I have a very basic scene with a Network Runner. The game is set to launch in shared mode automatically.

I have one object with a Rigidbody, a Network Object and a Network Rigidbody components.

When I start two instances of the game, one of them is able to move the object and that change is copied just fine on the other instance. But when I try to invert the roles, it doesn't work. If I grab the object in the second instance, it doesn't move in the first one and the instant I drop it, it goes back to its original position.

Also, the method TeleportToPosition isn't doing anything.

What am I doing wrong?

Thanks for your help

Comments

emotitron
2022-05-02 13:30:24

Are you changing the StateAuthority for the object to the other player? Only the StateAuthority of the object can modify its position. If a player which does not have StateAuthority moves it, then those changes will be quickly overwritten by incoming states from the actual authority.

A player can take over authority with:  Object.RequestStateAuthority();

Whoever, either the previous authority must first call Object.ReleaseStateAuthority(), or the NetworkObject must have AllowStateAuthorityOverride enabled.

Back to top