コード例 #1
0
ファイル: NSTElementsEngine.cs プロジェクト: lenix2/VRProject
 public void OnRewindGhostsToFrame(Frame frame)
 {
     for (int eid = 0; eid < elementCount; ++eid)
     {
         TransformElement te = transformElements[eid];
         te.Apply(te.frames[frame.frameid].xform, te.rewindGO);
     }
 }
コード例 #2
0
ファイル: NSTElementsEngine.cs プロジェクト: lenix2/VRProject
        /// <summary>
        /// If a Rewind request has been made, this callback interface is called on all registered elements. Each element will populate its history[0] frame with the resuts of the requested rewind time.
        /// If applyToGhost is true, it will also apply its rewound result to its element on the rewindGhost for this NST.
        /// </summary>
        public void OnRewind(HistoryFrame fe, GameObject rewindGo, int startFrameid, int endFrameId, float timeBeforeSnapshot, float remainder, bool applyToGhost)
        {
            for (int eid = 0; eid < elementCount; ++eid)
            {
                TransformElement te = transformElements[eid];
                //TODO: this needs to slerp for rotation types
                te.history[frameCount] = (timeBeforeSnapshot > 0) ?
                                         Vector3.Lerp(te.history[startFrameid], te.history[endFrameId], remainder) :
                                         Vector3.Lerp(te.history[startFrameid], te.Localized, -remainder);

                if (applyToGhost)
                {
                    te.Apply(te.history[frameCount], te.rewindGO);
                }
            }
        }