- Home /
Question by
junglejapes · Nov 18, 2013 at 03:14 AM ·
photon
OnPhotonSerializeView streams effecting eachother.
Throwing knife code.
void OnPhotonSerializeView(PhotonStream streamknife, PhotonMessageInfo infoknife)
{
if (streamknife.isWriting)
{
streamknife.SendNext(transform.position);
streamknife.SendNext(transform.rotation);
streamknife.SendNext(rigidbody.velocity);
}
else
{
transform.position = (Vector3)streamknife.ReceiveNext();
transform.rotation = (Quaternion)streamknife.ReceiveNext();
rigidbody.velocity = (Vector3)streamknife.ReceiveNext();
}
}
void OnPhotonSerializeView(PhotonStream streamplayer, PhotonMessageInfo infoplayer)
{
if (streamplayer.isWriting)
{
streamplayer.SendNext(transform.position);
streamplayer.SendNext(transform.rotation);
streamplayer.SendNext(rigidbody.velocity);
}
else
{
transform.position = (Vector3)streamplayer.ReceiveNext();
transform.rotation = (Quaternion)streamplayer.ReceiveNext();
rigidbody.velocity = (Vector3)streamplayer.ReceiveNext();
}
}
So I am seeing players and instantiating projectiles in the game accurately but as soon as I throw a knife and begin moving my player the knife's velocity copies the players every once in a while and when it land completely copies the players movement.
I dont really get it. I am sending data through 2 different streams so I should be reading 2 different data packets. My knife seems to be reading both its own data AND my players.
My player however is not picking up on my projectiles velocity,
any photon users care to show me whats wrong?
Comment