Photon view is not working.

Options
Hi community,

I start developing a little multiplayer VR game. It was ok, but suddenly I found this big big big problem:
When I pick up the pieces, they shake all time. The transfer execute correctly, and I also desactivate the rigidbody, just in case.
(add to the object)
[...]
protected override void OnSelectEntering(XRBaseInteractor interactor)
{
if (photonView.IsMine && photonView.IsOwnerActive)
{
Debug.Log("isMine");
}
else
{
rigidbodyObj.isKinematic = true;
rigidbodyObj.detectCollisions = false;
rigidbodyObj.useGravity = false;
//To desactivate rigidbody
photonView.RequestOwnership();
}

base.OnSelectEntering(interactor);
return;
}
[...]

(add to the object)

public class OwnerShipTransfer : MonoBehaviourPun, IPunOwnershipCallbacks
{
private void Awake()
{
PhotonNetwork.AddCallbackTarget(this);
}
private void OnDestroy()
{
PhotonNetwork.RemoveCallbackTarget(this);
}

public void OnOwnershipRequest(PhotonView targetView, Player requestingPlayer)
{
if (targetView != base.photonView)
return;
base.photonView.TransferOwnership(requestingPlayer);
}

public void OnOwnershipTransfered(PhotonView targetView, Player previousOwner)
{
if (targetView != base.photonView)
return;

}

public void OnOwnershipTransferFailed(PhotonView targetView, Player senderOfFailedRequest)
{
if (targetView != base.photonView)
return;
}

}

I add a link for the video (https://youtu.be/NqjiGqcg5i8)

Could Anyone here help me?
Thanks!!

Answers

  • Tobias
    Options
    Might be the check if IsMine and IsOwnerActive.
    Only check IsMine. It tells you if this client has control and should send updates / react to input. If this is false, this client will get updates, which will modify the position as defined remotely.