Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

How to synchronize a rigidbody's position that will change owners often

$
0
0
I'm working on a first-person game where players can pickup and throw weapons. Each weapon has a photon view set to takeover, when the weapon is picked up by a player the weapon transfers the ownership of it's photon view to the respective photon player. What I'm trying to figure out is how to synchronize the weapon's position and rotation after a player has thrown it. Not only does the weapon's position need to be synchronized after it is thrown, but when any other player interacts with the weapon's rigidbody after it has been thrown (hits it, pushes it, etc.).

My original thought was that the last player who used the weapon would be in charge of calculating the weapon's physics, the rigidbody would be turned off on all other clients and it's movement would be replicated. But I'm not sure how I would handle the instance where another player tries to interact with the weapon's rigidbody.

This is not critical to the gameplay, so long as it "looks" synchronized and the weapon ends up in the same position on all clients once it has stopped moving, that would be more than enough.

Any help would be great.

Viewing all articles
Browse latest Browse all 8947

Trending Articles