/// <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 i = 0; i < history[0].Length; i++) { //TODO: this needs to slerp for rotation types history[0][i] = (timeBeforeSnapshot > 0) ? Vector3.Lerp(history[startFrameid][i], history[endFrameId][i], remainder) : Vector3.Lerp(history[startFrameid][i], transformElements[i].Localized, -remainder); if (applyToGhost) { transformElements[i].Apply(history[0][i], transformElements[i].rewindGO); } } }
/// <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); } } }