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 PUN.

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 do I sync head rotation over network?

Luca
2021-09-01 20:36:16

So I got this code to make my head rotate vertically with my mouse, I tried syncing this over the network but can't seem to get this to work. I've seen alot of threads on this and Unity's forum but still haven't got a good solution, this guy figured it out 'https://forum.photonengine.com/discussion/18057/moving-a-bone-on-a-humanoid-character-best-way-to-do-this-in-pun', But I don't really understand it.

Here is the code I use which works locally:

Comments

Tobias
2021-09-02 09:39:08

The LateUpdate checks IsMine. So the code in that block will only run on the controlling player's client.
Is that intended?

Luca
2021-09-02 10:42:32

Yes, I want every individual player to have their head rotate up and down with mouse input

Tobias
2021-09-03 10:12:28

There is no code that applies the rotation for non-local players. OnPhotonSerializeView reads the incoming value into a local variable and that's it.

Luca
2021-09-06 21:04:24

Found a solution. for everyone trying the same thing, put this script on your character:

Tobias
2021-09-08 10:10:20

RPCs are very ineffective to do this. You waste quite a bit of network traffic and messages/sec this way.
Better use OnPhotonSerializeView.

Back to top