Obi Official Forum
Help What is the best solution for big ratio between rope and attached objects - 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: Help What is the best solution for big ratio between rope and attached objects (/thread-3078.html)



What is the best solution for big ratio between rope and attached objects - Tattler - 23-08-2021

I have a scene with small boat(tug boat) which must pull a bigger ship. I try to attach both boats with obi rope. Small boat is 400 tons and the big ship is 32 000 tons. I try to create 50m rope, with less elasticity as possible. To achieve this I set particle mass to be 150kg and have around 1000 particles, which makes rope mass of 150 tons. I set distance constraint iteration to 30, set substep to 8.

With this setup when I add required force to the small boat, the rope stretches to around 60m and start pulling the big ship which is final result I want. 

My questions is:

- Can I do something more to make rope less elastic with this kind of attached objects mass with way bigger ratio than 10:1.
- Can I find what force applies rope to the attached objects. Because of unrealistic heavy rope(150 tons), when I connect rope to the small boat, the rope itself start pulling small boat in his direction. If I can find what is the force of the rope, maybe can put opposite force to the small boat to balance this force and prevent small boat from moving.

Any help will be appreciated!


RE: What is the best solution for big ratio between rope and attached objects - josemendez - 24-08-2021

Hi!

Keeping in mind that large mass ratios are the bane of iterative solvers, and that both Obi and Unity's engine (PhysX) are iterative, you should simply either: a) avoid large mass ratios b) use a physics engine w/ direct solver for this. (Agx Dynamics comes to mind). Depending on your needs, using a reduced coordinates solver (articulations, in recent Unity versions) might also help.

If you're forced to use an iterative solution:

Quote:I set distance constraint iteration to 30, set substep to 8.

Use 30 substeps and 1 iteration. Both cheaper and better quality. Iterations should always be used to adjust constraint "effort" relative to other constraints, but since substeps are much more effective that iterations at improving convergence you should really try to increase substeps first, then adjust iterations if you want to spend some more time on specific types of constraint.

Quote:Can I do something more to make rope less elastic with this kind of attached objects mass with way bigger ratio than 10:1.

Increasing the amount of substeps is the only viable approach. Iterative solvers just aren't designed to deal with such huge mass ratios, pretty much all games use iterative solvers, so masses are clamped to not exceed a maximum ratio. It's like using a hammer to place screws, wrong tool for the task.

Quote:Can I find what force applies rope to the attached objects. Because of unrealistic heavy rope(150 tons), when I connect rope to the small boat, the rope itself start pulling small boat in his direction. If I can find what is the force of the rope, maybe can put opposite force to the small boat to balance this force and prevent small boat from moving.

You can, all constraints have a lambda array that stores positional lagrange multipliers for each constraint. To convert a lagrange multiplier to a force magnitude, divide by timestep squared:

Code:
force = batch.lambas[constraintIndex] / (deltaTime * deltaTime);

To access constraint data at runtime, see:
http://obi.virtualmethodstudio.com/manual/6.2/scriptingconstraints.html

However this won't work the way you think: F = ma, so adding an opposite force to "counteract" the force exerted by the rope will yield the exact same result as reducing the rope's mass or increasing the object's mass.