예제 #1
0
        private void CountOneSyncMessage(ref int count, LiveMessageSynchronizeAll syncMsg)
        {
            // 求取平均值
            count++;

            syncCameraPos += syncMsg.position;
            if (count <= 1)
            {
                syncCameraRot      = syncMsg.rotation;
                syncCameraRotFirst = syncCameraRot;
            }
            else
            {
                syncCameraRot = MathUtility.AverageQuaternion(ref syncCameraRotTemp, syncMsg.rotation, syncCameraRotFirst, count);
            }

            for (int i = 0; i < anchorController.anchorObjectList.Count; i++)
            {
                if (i >= syncMsg.anchorCount)
                {
                    continue;
                }

                syncAnchorPos[i] += syncMsg.anchorPositionList[i];

                if (count <= 1)
                {
                    syncAnchorRot[i]      = syncMsg.anchorRotationList[i];
                    syncAnchorRotFirst[i] = syncAnchorRot[i];
                }
                else
                {
                    Vector4 temp = syncAnchorRotTemp[i];
                    syncAnchorRot[i]     = MathUtility.AverageQuaternion(ref temp, syncMsg.anchorRotationList[i], syncAnchorRotFirst[i], count);
                    syncAnchorRotTemp[i] = temp;
                }

                // 只要还有消息表明没能定位,就表示没定位
                if (!syncMsg.anchorIsLocated[i])
                {
                    anchorLocated = false;
                }
            }
        }