Obi Official Forum
ObiPathSmoother influences physics? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: ObiPathSmoother influences physics? (/thread-2114.html)



ObiPathSmoother influences physics? - TheMunk - 26-03-2020

So I was trying to optimize my scene by lowering the smoothing levels of ropes not on camera - hoping that would lead to faster mesh/line rendering. 
However, I've noticed doing this on one of my ropes influences its physics:



Code:
private void OnBecameVisible()
   {
       SetVisuals(true);
   }

   private void OnBecameInvisible()
   {
       SetVisuals(false);
   }

   private void SetVisuals(bool state)
   {
       onCamera = state;

       //will only reappear if solver is enabled
       if (_obiSolver.enabled)
       {
           /*if (_ropeExtruder)
               _ropeExtruder.enabled = state;
           if (_ropeLineRenderer)
               _ropeLineRenderer.enabled = state;
           */
           if (state)
               _obiPathSmoother.smoothing = ogPathSmoothingLevel;
           else
               _obiPathSmoother.smoothing = 0;
       }
   }
If I disable the script, the simulation is more stable (and correct) - if enabled the rope particles (close to dynamically updated static attachments) will freak out.

Is this expected behavior? Isn't the smoothing only for visuals? not for physics?


RE: ObiPathSmoother influences physics? - josemendez - 26-03-2020

(26-03-2020, 10:35 AM)TheMunk Wrote: So I was trying to optimize my scene by lowering the smoothing levels of ropes not on camera - hoping that would lead to faster mesh/line rendering. 
However, I've noticed doing this on one of my ropes influences its physics:



Code:
private void OnBecameVisible()
   {
       SetVisuals(true);
   }

   private void OnBecameInvisible()
   {
       SetVisuals(false);
   }

   private void SetVisuals(bool state)
   {
       onCamera = state;

       //will only reappear if solver is enabled
       if (_obiSolver.enabled)
       {
           /*if (_ropeExtruder)
               _ropeExtruder.enabled = state;
           if (_ropeLineRenderer)
               _ropeLineRenderer.enabled = state;
           */
           if (state)
               _obiPathSmoother.smoothing = ogPathSmoothingLevel;
           else
               _obiPathSmoother.smoothing = 0;
       }
   }
If I disable the script, the simulation is more stable (and correct) - if enabled the rope particles (close to dynamically updated static attachments) will freak out.

Is this expected behavior? Isn't the smoothing only for visuals? not for physics?

You're right: smoothing only affects rendering. It is performed as a post-process after simulating each frame, its results are not feed back to the simulation in any way.

I can't reproduce any differences in physical behavior when changing smoothing. Can you give more details about your setup?


RE: ObiPathSmoother influences physics? - TheMunk - 26-03-2020

(26-03-2020, 10:58 AM)josemendez Wrote: You're right: smoothing only affects rendering. It is performed as a post-process after simulating each frame, its results are not feed back to the simulation in any way.

I can't reproduce any differences in physical behavior when changing smoothing. Can you give more details about your setup?

So one rope with 2 static attachments - one to an object that doesn't move at all - another to object A.

Another rope - a loop - has both its ends connected to object A, but only 1 is dynamic - the other is static. This rope has two other static attachments along the loop which a character will grab (using position constraints) and move.

Normally this works fine, but with the script attached above (to only the first rope) both ropes start acting weird.