const float UNCHANGED = 0.0000006f; //arbitrary number to check how the final vector is affected public void ReadPlayer(byte[] binaryData) { logicHandler.dataRecieved += binaryData.Length;// + 28; //udp header size (is it included?) //print("recieved data of length: " + binaryData); logicHandler.UpdatePacketText(); byte header = binaryData[0]; int finalDataIndex = 1; Vector3 tempPos = new Vector3(UNCHANGED, UNCHANGED, UNCHANGED); //0.0000006 six 0s and then 6, unchanged mod if ((byte)(header << 1) >> 7 == 1) { tempPos.x = System.BitConverter.ToSingle(binaryData, finalDataIndex);//binaryData[finalDataIndex++]; //print("tempos.x: " + tempPos.x); finalDataIndex += 4; } if ((byte)(header << 2) >> 7 == 1) { tempPos.y = System.BitConverter.ToSingle(binaryData, finalDataIndex);//binaryData[finalDataIndex++]; finalDataIndex += 4; } if ((byte)(header << 3) >> 7 == 1) { tempPos.z = System.BitConverter.ToSingle(binaryData, finalDataIndex);//binaryData[finalDataIndex++]; finalDataIndex += 4; } Vector3 finalVec = FixVector(tempPos, logicHandler.playerStructs[(byte)(header >> 7)].playerGameObject.transform.position); //print(finalVec); //GameObject fake = Instantiate(emptyCube); //emptyCube.transform.position = finalVec; logicHandler.playerStructs[(byte)(header >> 7)].playerGameObject.transform.position = finalVec; InterpolatePlayer(binaryData); //print(FixVector(tempPos, logicHandler.binaryPacker.player1.transform.position)); //logicHandler.binaryPacker.player1.transform.position = FixVector(tempPos, logicHandler.binaryPacker.player1.transform.position); }