Пример #1
0
        public ReplayRecordedFrame(ReplayRecordedFrame a, ReplayRecordedFrame b, float time)
        {
            float t = (time - a.time) / (b.time - a.time);

            this.time           = time;
            this.transformInfos = new TransformInfo[a.transformInfos.Length];
            for (int i = 0; i < a.transformInfos.Length; i++)
            {
                this.transformInfos[i] = TransformInfo.Lerp(a.transformInfos[i], b.transformInfos[i], t);
            }
        }
Пример #2
0
        private void RecordFrame()
        {
            var transformInfos = new TransformInfo[transformsToBeRecorded.Count];

            for (int i = 0; i < transformsToBeRecorded.Count; i++)
            {
                Transform t = transformsToBeRecorded[i];
                transformInfos[i] = new TransformInfo(t);
                if (!PlayerController.Instance.respawn.bail.bailed && t == PlayerHeadIK.head)
                {
                    transformInfos[i].rotation = Quaternion.Inverse(t.parent.rotation) * PlayerHeadIK.currentRot.rotation;  //Fixes Head jitter
                }
            }
            ReplayRecordedFrame newFrame = new ReplayRecordedFrame()
            {
                time           = this.endTime,
                transformInfos = transformInfos
            };

            this.RecordedFrames.Add(newFrame);
        }
Пример #3
0
 public static TransformInfo Lerp(TransformInfo a, TransformInfo b, float t)
 {
     return(new TransformInfo(Vector3.Lerp(a.position, b.position, t), Quaternion.Lerp(a.rotation, b.rotation, t), Vector3.Lerp(a.scale, b.scale, t)));
 }