27-10-2017, 08:09 PM
(26-10-2017, 10:02 AM)josemendez Wrote: Amen to what niZmo said.
To further explain the situation: All physics simulations are composed of several "parts" or "bodies" (particles in Obi's case) that interact together in some way. These interactions are represented by a set of equations that must be solved exactly or approximately.
Very broadly speaking, there are two kinds of physics solvers: direct and iterative. Direct solvers take all equations (that relate all parts in the simulation) and try to find the exact solution in one go. They are usually fast enough for small scenes (2, 3, 10 equations) but as the amount of equations grow, they can become extremely expensive. To achieve zero stretch, zero bounce, (that is, a perfect simulation) you'd need a direct solver, and these are too slow to be used in realtime.
On the other hand, iterative solvers -Obi, PhysX, Bullet, Box2D, Havok...nearly all game physics engines- do several quick passes (iterations) over all equations, getting closer to the exact solution each time. You can stop the process at any time and get a reasonably good solution. The more times you let the solver iterate, the better the solution (that is, less stretchy rope). These are much faster and you can easily adjust quality/performance. The downside is that they won't get you an exact solution unless you use a lot of iterations (and most of the time, they will still arrive faster at the solution than a direct solver).
So, direct solvers are used in scientific scenarios where accuracy is paramount (seen them used for surgical suture simulators, where all there is in the scene is a single thread). For games, iterative solvers are the way to go. So as niZmo said, it is not possible to get zero stretch in the general case. Not with Obi, not with any other physics engine. There are tricks that you can use for certain scenarios (he mentioned tether constraints), but that's all.
That being said: crank up the amount of distance constraint iterations in ObiSolver to get less stretchy rope. How high you can set the iteration count depends on your performance budget and your tolerance for stretchiness.
Thanks for the insight! Coincidentally, I am working on a surgical suture simulator, and for my purposes the generated tether constraints are sufficient. Stiffness seems to be the the next hurdle at the moment.
Would you be able to recommend any additional iterative options I can work with through Obi, or perhaps an external resource that would be able to function in a scientific scenario such as surgical suturing? I appreciate any guidance you can send my way.