Obi Official Forum
Wrapping rope - 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: Wrapping rope (/thread-688.html)



Wrapping rope - Qeran - 14-09-2018

Hello!

I've purchased Obi Rope a few days ago and I'm trying to find solution for wrapping rope around object. In my opinion such a basic mechanism should be easy to do or presented in tutorial/examples. I want to achieve wrapping like in this game: https://www.youtube.com/watch?v=vPEvAxjay1s

I cannot increase the rope length and maintain stretching scale very low. In consequence the rope doesn't stick to object collider, like in the picture in attachment.
Can you advice me how to use Obi Rope asset to achieve good wrapping, please?


RE: Wrapping rope - josemendez - 15-09-2018

(14-09-2018, 06:47 PM)Qeran Wrote: Hello!

I've purchased Obi Rope a few days ago and I'm trying to find solution for wrapping rope around object. In my opinion such a basic mechanism should be easy to do or presented in tutorial/examples. I want to achieve wrapping like in this game: https://www.youtube.com/watch?v=vPEvAxjay1s

I cannot increase the rope length and maintain stretching scale very low. In consequence the rope doesn't stick to object collider, like in the picture in attachment.
Can you advice me how to use Obi Rope asset to achieve good wrapping, please?

Hi,

Well, despite what it might look like, Zen Bound does not use physics at all. This is given away by the fact that the "rope" does not have any slack at any point during gameplay, it is always perfectly tense. All physics solvers (such as Obi) degrade with the amount of constraints imposed on the system, (such as when increasing the length of the rope, or making a very tall pile of boxes in Unity) thus increasing the need for more solver substeps/iteration to keep quality constant, which in turn adversely affects performance. See:

http://obi.virtualmethodstudio.com/tutorials/obisolver.html
http://obi.virtualmethodstudio.com/tutorials/convergence.html

Zen Bound uses a much simpler approach: straight line segments and basic raycast intersection tests, simular to what the ninja rope in the Worms series does. Only the couple last segments of rope (the one that stems from the camera and the next one) are "alive" at any given moment. It uses raycasting to determine the closest shape edge to the intersection of a ray going from the camera to the second "joint" of the rope . Similar to what's done in this tutorial, only 3D instead of 2D:
https://www.raywenderlich.com/348-make-a-2d-grappling-hook-game-in-unity-part-1

As you wrap the rope around the wooden shape, the "rope" becomes just a static part of the shape. This ensures performance and behaviour are always the same, no matter how much rope you've wrapped around the object.

As you can see this is not a physics simulation at all, just some geometric trickery. I'm afraid using a physics solver is the wrong approach to this. If you're sure you want to use it in some form, I'd suggest a hybrid method: use rope physics for only the last two segments, together with raycasting to determine where the rope ceases to be a "true" rope and becomes part of the shape.