OnPhotonSerializeView() Vector3s looking like Vector4s
Options
Hello,
I'm having problems passing a Vector3 through photon. Essentially we are sending a Vector3, followed by a Float through OnSerliezeView. On the receive end we are getting a Vector4 and thus having a casting issue because we are expecting a Vector3.
We have since moved the Float to before the Vector3 send as denoted below and it seems like it is working fine now.
I'm having problems passing a Vector3 through photon. Essentially we are sending a Vector3, followed by a Float through OnSerliezeView. On the receive end we are getting a Vector4 and thus having a casting issue because we are expecting a Vector3.
We have since moved the Float to before the Vector3 send as denoted below and it seems like it is working fine now.
if (stream.isWriting)
{
stream.SendNext(colliders.localRotation.eulerAngles.y);
stream.SendNext(carRigidbody.position);
stream.SendNext(carRigidbody.velocity);
stream.SendNext(new Vector3(carRigidbody.rotation.eulerAngles.x, carRigidbody.rotation.eulerAngles.y, carRigidbody.rotation.eulerAngles.z));
}
else
{
PacketInfo packet;
packet.mTime = info.timestamp;
packet.mDriftAngle = (float)stream.ReceiveNext();
packet.mPosition = (Vector3)stream.ReceiveNext();
packet.mVelocity= (Vector3)stream.ReceiveNext();
Vector3 EulerAngles = (Vector3)stream.ReceiveNext();
packet.mRotation = Quaternion.EulerAngles(EulerAngles);
0
Comments
-
Just wanted to post about this to see if this is a known issue or if we are doing something stupid.0
-
Hi,
can you paste how you had your writing routine before, when you experienced problems?
Bye,
Jean0