public static void LateVisualize() { if (Simulated) { AccumulatedTime = Time.deltaTime; } else { AccumulatedTime += Time.deltaTime; } LerpTime = (float)(AccumulatedTime / PhysicsManager.FixedDeltaTime); for (int i = 0; i < DynamicSimObjects.PeakCount; i++) { LSBody b1 = DynamicSimObjects.innerArray[i]; if (b1.IsNotNull()) { if (Simulated) { b1.SetVisuals(); } b1.Visualize(); } } if (Simulated) { Simulated = false; } }
public static void LateVisualize() { // bool doSetVisuals = false; // if (AccumulatedTime >= PhysicsManager.FixedDeltaTime && Simulated) { // AccumulatedTime = Time.deltaTime + (LerpTime % PhysicsManager.FixedDeltaTime); // doSetVisuals = true; // Simulated = false; // } else { // AccumulatedTime += Time.deltaTime; // } // LerpTime = (float)(AccumulatedTime / PhysicsManager.FixedDeltaTime); // if (LerpTime > 1f) LerpTime = 1f; // for (int i = 0; i < DynamicSimObjects.PeakCount; i++) { // LSBody b1 = DynamicSimObjects.innerArray[i]; // // if (b1.IsNotNull()) { // if (doSetVisuals) { // b1.SetVisuals(); // } // b1.Visualize(); // } // } LerpTime = (float)PhysicsManager.FixedDeltaTime / (float)Time.timeScale; for (int i = 0; i < DynamicSimObjects.PeakCount; i++) { LSBody b1 = DynamicSimObjects.innerArray[i]; if (b1.IsNotNull()) { b1.SetVisuals(); } } }
public static void Visualize() { LerpDamping = 1f; double curTime = LockstepManager.Seconds; AccumulatedTime += (curTime - LastTime) * Time.timeScale; LerpTime = (float)(AccumulatedTime / FixedDeltaTime); if (LerpTime < 1f) { for (int i = 0; i < PeakCount; i++) { if (SimObjectExists [i]) { LSBody b1 = SimObjects [i]; b1.Visualize(); } } } else { AccumulatedTime %= FixedDeltaTime; ExtrapolationAmount = LerpTime; LerpTime = (float)(AccumulatedTime / FixedDeltaTime); if (Simulated) { for (int i = 0; i < PeakCount; i++) { if (SimObjectExists [i]) { LSBody b1 = SimObjects [i]; b1.LerpOverReset(); b1.SetVisuals(); b1.Visualize(); } } Simulated = false; } else { for (int i = 0; i < PeakCount; i++) { if (SimObjectExists[i]) { LSBody b1 = SimObjects[i]; b1.LerpOverReset(); b1.SetExtrapolatedVisuals(); b1.Visualize(); } } } } LastTime = curTime; }
public static void Visualize () { LerpTime = Time.fixedDeltaTime; if (ResetAccumulation) { AccumulatedTime = 0; } AccumulatedTime += Time.deltaTime; ExpectedAccumulation = AccumulatedTime / LerpTime; for (int i = 0; i < DynamicSimObjects.PeakCount; i++) { LSBody b1 = DynamicSimObjects.innerArray[i]; if (b1.IsNotNull()) { b1.SetVisuals(); } } ResetAccumulation = false; }