Example #1
0
        void Update()
        {
            if (!softVolume.Ready())
            {
                return;
            }

            if (photonView.isMine)
            {
                position        = softVolume.currOrientation.GetColumn(3);
                prevPosition    = softVolume.prevOrientation.GetColumn(3);
                orientation     = GetOrientation(softVolume.currOrientation);
                prevOrientation = GetOrientation(softVolume.prevOrientation);
            }
            else
            {
                var t = PhotonNetwork.time - sendTime;
                var z = (float)(t / softVolume.world.deltaTime);

                Vector3    v = position - prevPosition;
                Vector3    p = position + v * z;
                Quaternion q =
                    Quaternion.SlerpUnclamped(prevOrientation, orientation, z);
                Matrix4x4 m = Matrix4x4.TRS(p, q, Vector3.one);
                matrix = m;
                softVolume.BlendPosition(m, blendFactor, velocityBlendFactor);
            }
        }