private void FixedUpdate() { ObiProfiler.EnableProfiler(); Physics.autoSimulation = !substepUnityPhysics; BeginStep(Time.fixedDeltaTime); float substepDelta = Time.fixedDeltaTime / (float)substeps; // Divide the step into multiple smaller substeps: for (int i = 0; i < substeps; ++i) { // Simulate Obi: Substep(substepDelta); // Simulate Unity physics: if (substepUnityPhysics) { Physics.Simulate(substepDelta); } } EndStep(substepDelta); ObiProfiler.DisableProfiler(); accumulatedTime -= Time.fixedDeltaTime; }
private void Update() { ObiProfiler.EnableProfiler(); Interpolate(Time.fixedDeltaTime, accumulatedTime); ObiProfiler.DisableProfiler(); accumulatedTime += Time.deltaTime; }
private void FixedUpdate() { ObiProfiler.EnableProfiler(); BeginStep(Time.fixedDeltaTime); float substepDelta = Time.fixedDeltaTime / (float)substeps; // Divide the step into multiple smaller substeps: for (int i = 0; i < substeps; ++i) { Substep(Time.fixedDeltaTime, substepDelta, substeps - i); } EndStep(substepDelta); ObiProfiler.DisableProfiler(); accumulatedTime -= Time.fixedDeltaTime; }