Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Slowed Simulation Problems
#1
Hello!

I've recently started using ObiCloth to enhance some of my characters' clothing and I'm in the process of integrating my own slo-mo logic into it (as I'm avoiding using Unity's own timescale).

Recently I've been running into a problem with the clothing deforming and "crinkling" during this slo-mo process. You can see this effect in this gif. You can also see the change that I've made to ObiSolver's LateUpdate (as I saw you recommended in a previous thread) posted below.

Any insight into this would be welcome (I'm also having problems with collisions and clipping but that's a separate issue that I'll bugfix later)!

Code:
private void LateUpdate(){

        if (Application.isPlaying && simulationOrder == SimulationOrder.LateUpdate){

               // smooth out timestep and accumulate it:
               if (SlowTimeManager.fTimeScaleGlobal != 0)
               {
                   smoothDelta = Mathf.Lerp(Time.deltaTime / SlowTimeManager.fTimeScaleGlobal, smoothDelta, 0.95f);
               }

               else
               {
                   return;
               }
            
             AccumulateSimulationTime(smoothDelta);
            SimulateStep(smoothDelta);

        }

        if (!Application.isPlaying)
            return;
 
        EndFrame (simulationOrder == SimulationOrder.LateUpdate ? smoothDelta : Time.fixedDeltaTime);

        if (OnFrameEnd != null)
            OnFrameEnd(this,null);
    }
Reply
#2
(16-08-2018, 11:37 AM)Reiffer Wrote: Hello!

I've recently started using ObiCloth to enhance some of my characters' clothing and I'm in the process of integrating my own slo-mo logic into it (as I'm avoiding using Unity's own timescale).

Recently I've been running into a problem with the clothing deforming and "crinkling" during this slo-mo process. You can see this effect in this gif. You can also see the change that I've made to ObiSolver's LateUpdate (as I saw you recommended in a previous thread) posted below.

Any insight into this would be welcome (I'm also having problems with collisions and clipping but that's a separate issue that I'll bugfix later)!

Code:
private void LateUpdate(){

if (Application.isPlaying && simulationOrder == SimulationOrder.LateUpdate){

               // smooth out timestep and accumulate it:
               if (SlowTimeManager.fTimeScaleGlobal != 0)
               {
                   smoothDelta = Mathf.Lerp(Time.deltaTime / SlowTimeManager.fTimeScaleGlobal, smoothDelta, 0.95f);
               }

               else
               {
                   return;
               }

AccumulateSimulationTime(smoothDelta);
            SimulateStep(smoothDelta);

}

if (!Application.isPlaying)
return;
 
EndFrame (simulationOrder == SimulationOrder.LateUpdate ? smoothDelta : Time.fixedDeltaTime);

if (OnFrameEnd != null)
OnFrameEnd(this,null);
}

Hi,

We have been unable to reproduce this by altering the code as per your example. The resulting simulation is completely smooth. Are you positive that:
1.- The solver's simulation order is indeed set to LateUpdate?
2.- SlowTimeManager.fTimeScaleGlobal is always >= 1? (as values smaller than 1 would speed things up instead of slowing them down)
Reply
#3
(16-08-2018, 02:50 PM)josemendez Wrote: Hi,

We have been unable to reproduce this by altering the code as per your example. The resulting simulation is completely smooth. Are you positive that:
1.- The solver's simulation order is indeed set to LateUpdate?
2.- SlowTimeManager.fTimeScaleGlobal is always >= 1? (as values smaller than 1 would speed things up instead of slowing them down)

fTimeScaleGlobal was the problem, as you noticed. My maths teach would be ashamed of me.

Thanks so much for the assist!
Reply