Esempio n. 1
0
    // Token: 0x06004F57 RID: 20311 RVA: 0x001AD0AC File Offset: 0x001AB4AC
    public void DoAdjustment(float now)
    {
        if (base.isMine || this.animator == null)
        {
            return;
        }
        IList <PoseRecorder.PoseEvent> eventList = this.eventHistory;

        if (PoseRecorder.f__mg0 == null)
        {
            PoseRecorder.f__mg0 = new TweenFunctions.TweenFunction <PoseRecorder.PoseEvent>(PoseRecorder.LinearTweenFunction);
        }
        PoseRecorder.PoseEvent poseEvent = TweenFunctions.Tween <PoseRecorder.PoseEvent>(eventList, PoseRecorder.f__mg0, (double)now - VRC.Network.SimulationDelay(base.Owner), this.ExpectedInterval, -1);
        if (poseEvent == null || poseEvent.Contains(PoseRecorder.PoseContents.Nothing))
        {
            return;
        }
        if (poseEvent.Contains(PoseRecorder.PoseContents.BaseSkeleton))
        {
            this.animator.enabled = false;
            for (int i = 0; i < 19; i++)
            {
                Quaternion localRotation = this.bones[i].localRotation;
                PoseRecorder.MaybeSetRotation(this.bones[i].localRotation, poseEvent.boneRotations[i], ref localRotation);
                this.bones[i].localRotation = localRotation;
            }
        }
        if (this.ik != null)
        {
            if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationL))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetHandEffectorLeft), new PoseRecorder.SetEffector(this.ik.SetRemoteHandEffectorLeft), poseEvent.leftHandPosition, poseEvent.leftHandRotation);
            }
            else
            {
                this.ik.ClearRemoteHandEffectorLeft();
            }
            if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationR))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetHandEffectorRight), new PoseRecorder.SetEffector(this.ik.SetRemoteHandEffectorRight), poseEvent.rightHandPosition, poseEvent.rightHandRotation);
            }
            else
            {
                this.ik.ClearRemoteHandEffectorRight();
            }
            if (poseEvent.Contains(PoseRecorder.PoseContents.HeadEffectorPositionOrientation))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetHeadEffector), new PoseRecorder.SetEffector(this.ik.SetRemoteHeadEffector), poseEvent.headPosition, poseEvent.headRotation);
            }
            if (poseEvent.Contains(PoseRecorder.PoseContents.HipEffectorPositionOrientation))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetHipEffector), new PoseRecorder.SetEffector(this.ik.SetRemoteHipEffector), poseEvent.hipPosition, poseEvent.hipRotation);
            }
            else
            {
                this.ik.ClearRemoteHipEffector();
            }
            if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationL))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetFootEffectorLeft), new PoseRecorder.SetEffector(this.ik.SetRemoteFootEffectorLeft), poseEvent.leftFootPosition, poseEvent.leftFootRotation);
            }
            else
            {
                this.ik.ClearRemoteFootEffectorLeft();
            }
            if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationR))
            {
                this.MaybeSetEffector(new PoseRecorder.GetEffector(this.ik.GetFootEffectorRight), new PoseRecorder.SetEffector(this.ik.SetRemoteFootEffectorRight), poseEvent.rightFootPosition, poseEvent.rightFootRotation);
            }
            else
            {
                this.ik.ClearRemoteFootEffectorRight();
            }
        }
        if (poseEvent.Contains(PoseRecorder.PoseContents.HandGesture))
        {
            if (this.handgest != null)
            {
                this.handgest.SetRemoteHandGestures((int)poseEvent.handGestureLeft, (int)poseEvent.handGestureRight);
            }
        }
        else if (this.handgest != null)
        {
            this.handgest.ClearRemoteHandGestures();
        }
        if (this.offset != null && poseEvent.Contains(PoseRecorder.PoseContents.RootOffset))
        {
            this.offset.localPosition = Vector3.zero;
        }
        if (this.animator != null && poseEvent.Contains(PoseRecorder.PoseContents.BaseSkeleton))
        {
            this.animator.enabled = true;
        }
        if (base.Owner.playerNet.WasRecentlyDiscontinuous)
        {
            this.ik.Reset(true);
        }
    }
Esempio n. 2
0
 // Token: 0x06004F51 RID: 20305 RVA: 0x001AC7FC File Offset: 0x001AABFC
 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     PoseRecorder.PoseEvent poseEvent = new PoseRecorder.PoseEvent();
     if (stream.isWriting)
     {
         if (this.ragDoll != null && this.ragDoll.IsRagDolled)
         {
             PoseRecorder.poseContents = 0;
         }
         poseEvent.poseContents    = PoseRecorder.poseContents;
         PoseRecorder.poseContents = 0;
         stream.SendNext((short)poseEvent.poseContents);
         if (poseEvent.Contains(PoseRecorder.PoseContents.RootOffset))
         {
             poseEvent.rootOffset = this.offset.position;
             this.SerializeVector(stream, poseEvent.rootOffset);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.BaseSkeleton))
         {
             for (int i = 0; i < this.bones.Length; i++)
             {
                 poseEvent.boneRotations[i] = ((!(this.bones[i] == null)) ? this.bones[i].rotation : Quaternion.identity);
                 this.SerializeQuaternion(stream, poseEvent.boneRotations[i]);
             }
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandGesture))
         {
             int num  = 255;
             int num2 = 255;
             if (this.handgest != null)
             {
                 this.handgest.GetRemoteHandGestures(out num, out num2);
             }
             stream.SendNext((byte)num);
             stream.SendNext((byte)num2);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationL))
         {
             if (this.ik != null)
             {
                 this.ik.GetHandEffectorLeft(out poseEvent.leftHandPosition, out poseEvent.leftHandRotation);
             }
             this.SerializeVector(stream, poseEvent.leftHandPosition);
             this.SerializeQuaternion(stream, poseEvent.leftHandRotation);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationR))
         {
             if (this.ik != null)
             {
                 this.ik.GetHandEffectorRight(out poseEvent.rightHandPosition, out poseEvent.rightHandRotation);
             }
             this.SerializeVector(stream, poseEvent.rightHandPosition);
             this.SerializeQuaternion(stream, poseEvent.rightHandRotation);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HeadEffectorPositionOrientation))
         {
             if (this.ik != null)
             {
                 this.ik.GetHeadEffector(out poseEvent.headPosition, out poseEvent.headRotation);
             }
             this.SerializeVector(stream, poseEvent.headPosition);
             this.SerializeQuaternion(stream, poseEvent.headRotation);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HipEffectorPositionOrientation))
         {
             if (this.ik != null)
             {
                 this.ik.GetHipEffector(out poseEvent.hipPosition, out poseEvent.hipRotation);
             }
             this.SerializeVector(stream, poseEvent.hipPosition);
             this.SerializeQuaternion(stream, poseEvent.hipRotation);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationL))
         {
             if (this.ik != null)
             {
                 this.ik.GetFootEffectorLeft(out poseEvent.leftFootPosition, out poseEvent.leftFootRotation);
             }
             this.SerializeVector(stream, poseEvent.leftFootPosition);
             this.SerializeQuaternion(stream, poseEvent.leftFootRotation);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationR))
         {
             if (this.ik != null)
             {
                 this.ik.GetFootEffectorRight(out poseEvent.rightFootPosition, out poseEvent.rightFootRotation);
             }
             this.SerializeVector(stream, poseEvent.rightFootPosition);
             this.SerializeQuaternion(stream, poseEvent.rightFootRotation);
         }
     }
     else
     {
         poseEvent.poseContents = (int)((short)stream.ReceiveNext());
         if (poseEvent.Contains(PoseRecorder.PoseContents.RootOffset))
         {
             poseEvent.rootOffset = this.DeserializeVector(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.BaseSkeleton))
         {
             for (int j = 0; j < this.bones.Length; j++)
             {
                 poseEvent.boneRotations[j] = this.DeserializeQuaternion(stream);
             }
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandGesture))
         {
             poseEvent.handGestureLeft  = (byte)stream.ReceiveNext();
             poseEvent.handGestureRight = (byte)stream.ReceiveNext();
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationL))
         {
             poseEvent.leftHandPosition = this.DeserializeVector(stream);
             poseEvent.leftHandRotation = this.DeserializeQuaternion(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationR))
         {
             poseEvent.rightHandPosition = this.DeserializeVector(stream);
             poseEvent.rightHandRotation = this.DeserializeQuaternion(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HeadEffectorPositionOrientation))
         {
             poseEvent.headPosition = this.DeserializeVector(stream);
             poseEvent.headRotation = this.DeserializeQuaternion(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.HipEffectorPositionOrientation))
         {
             poseEvent.hipPosition = this.DeserializeVector(stream);
             poseEvent.hipRotation = this.DeserializeQuaternion(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationL))
         {
             poseEvent.leftFootPosition = this.DeserializeVector(stream);
             poseEvent.leftFootRotation = this.DeserializeQuaternion(stream);
         }
         if (poseEvent.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationR))
         {
             poseEvent.rightFootPosition = this.DeserializeVector(stream);
             poseEvent.rightFootRotation = this.DeserializeQuaternion(stream);
         }
     }
     poseEvent.timeReceived = (double)Time.time;
     TweenFunctions.RecordValue <PoseRecorder.PoseEvent>(this.eventHistory, poseEvent);
 }
Esempio n. 3
0
    // Token: 0x06004F53 RID: 20307 RVA: 0x001ACCEC File Offset: 0x001AB0EC
    private static PoseRecorder.PoseEvent LinearTweenFunction(IList <PoseRecorder.PoseEvent> l, int idx, double delta)
    {
        PoseRecorder.PoseEvent poseEvent  = l[idx];
        PoseRecorder.PoseEvent poseEvent2 = l[TweenFunctions.FindNextIndex <PoseRecorder.PoseEvent>(l, idx)];
        float t = (float)delta;

        PoseRecorder.PoseEvent poseEvent3 = new PoseRecorder.PoseEvent
        {
            poseContents = (poseEvent.poseContents & poseEvent2.poseContents),
            timeReceived = (poseEvent2.timeReceived - poseEvent.timeReceived) * delta + poseEvent.timeReceived
        };
        if (poseEvent2.Contains(PoseRecorder.PoseContents.HandGesture))
        {
            poseEvent3.handGestureLeft  = poseEvent2.handGestureLeft;
            poseEvent3.handGestureRight = poseEvent2.handGestureRight;
            poseEvent3.poseContents    |= 16;
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.Nothing))
        {
            return(poseEvent3);
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.RootOffset))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rootOffset, Vector3.Lerp(poseEvent.rootOffset, poseEvent2.rootOffset, t), ref poseEvent3.rootOffset);
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.BaseSkeleton))
        {
            poseEvent3.boneRotations = new Quaternion[19];
            for (int i = 0; i < 19; i++)
            {
                poseEvent3.boneRotations[i] = Quaternion.Slerp(poseEvent.boneRotations[i], poseEvent2.boneRotations[i], t).Normalize();
            }
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationL))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.leftHandPosition, Vector3.Lerp(poseEvent.leftHandPosition, poseEvent2.leftHandPosition, t), ref poseEvent3.leftHandPosition);
            poseEvent3.leftHandRotation = Quaternion.Slerp(poseEvent.leftHandRotation, poseEvent2.leftHandRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationR))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rightHandPosition, Vector3.Lerp(poseEvent.rightHandPosition, poseEvent2.rightHandPosition, t), ref poseEvent3.rightHandPosition);
            poseEvent3.rightHandRotation = Quaternion.Slerp(poseEvent.rightHandRotation, poseEvent2.rightHandRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HeadEffectorPositionOrientation))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.headPosition, Vector3.Lerp(poseEvent.headPosition, poseEvent2.headPosition, t), ref poseEvent3.headPosition);
            poseEvent3.headRotation = Quaternion.Slerp(poseEvent.headRotation, poseEvent2.headRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HipEffectorPositionOrientation))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.hipPosition, Vector3.Lerp(poseEvent.hipPosition, poseEvent2.hipPosition, t), ref poseEvent3.hipPosition);
            poseEvent3.hipRotation = Quaternion.Slerp(poseEvent.hipRotation, poseEvent2.hipRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationL))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.leftFootPosition, Vector3.Lerp(poseEvent.leftFootPosition, poseEvent2.leftFootPosition, t), ref poseEvent3.leftFootPosition);
            poseEvent3.leftFootRotation = Quaternion.Slerp(poseEvent.leftFootRotation, poseEvent2.leftFootRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationR))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rightFootPosition, Vector3.Lerp(poseEvent.rightFootPosition, poseEvent2.rightFootPosition, t), ref poseEvent3.rightFootPosition);
            poseEvent3.rightFootRotation = Quaternion.Slerp(poseEvent.rightFootRotation, poseEvent2.rightFootRotation, t).Normalize();
        }
        return(poseEvent3);
    }