Example #1
0
        private static void RunTest(ulong t1, Quaternion rot1, ulong t2, Quaternion rot2, ulong t3,
                                    Quaternion expectation)
        {
            var predictedQuaternion = new PredictedQuaternion();

            predictedQuaternion.ReceiveValue(t1, rot1);
            predictedQuaternion.ReceiveValue(t2, rot2);
            Assert.AreEqual(0, Quaternion.Angle(expectation, predictedQuaternion.Get(t3)));
        }
Example #2
0
        private void Update()
        {
            Transform t = transform;

            // submit
            if (HasAuthority)
            {
                _lastUpdateTime = Server.Time;
                _latestPosition = t.position;
                _latestRotation = t.rotation;
                _predictedPosition.ReceiveValue(_lastUpdateTime, _latestPosition);
                _predictedRotation.ReceiveValue(_lastUpdateTime, _latestRotation);
                SetDirty((byte)DirtyMask.Position);
                SetDirty((byte)DirtyMask.Rotation);
            }
            // receive
            else if (!Hold)
            {
                UpdateTransform();
            }
        }