# QuickRopes Rope Physics Tools

Discussion in 'Assets and Asset Store' started by reveriejake, Apr 20, 2012.

1. ### davedev

Joined:
Jan 12, 2009
Posts:
67
QuickRopes looks really cool. I'd like to have a gameobject resting on a horizontal rope and the user to be able to pull down the rope at any point stretching the rope and then release the rope thereby flinging the game object into the air. Can quick ropes do this? If so, what would be the general procedure?

2. ### Chris12345

Joined:
Jul 14, 2012
Posts:
10
How can i make a grapple hook with this? I do think it is possible but do not know were to start. i have looked all over and found nothing.

3. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
Hi !

I just bought quickrope, thank you !

Is it possible to know the force (weight?) Gameobject to "tip" (see picture) on which I tied the rope?
This is useful for animating realistic way the fishing rod

4. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
In fact:
Can we know the tension of the rope ?

5. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
I tried :
Code (csharp):
1.
2.     public static float GetRopeLength(QuickRope2 rope){
3.         float length = 0;
4.         for (int l = 1; l < rope.Joints.Count; l++)
5.             length += Vector3.Distance(rope.Joints[l-1].transform.position, rope.Joints[l].transform.position);
6.         return length;
7.     }
8.
9.     public static float getTension(QuickRope2 rope){
10.         float maxJointsDistance = Vector3.Distance(rope.Joints[0].transform.position, rope.Joints[rope.Joints.Count - 1].transform.position);
11.         return GetRopeLength(rope) - maxJointsDistance;
12.     }
13.

Last edited: Jun 21, 2013
6. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
@eiwer
QuickRopes is not really ideal for Mobile. It will work on mobile but your have to keep in mind that in the current version each joint is a gameobject. So if you have 100 joints then you are rendering 100 objects. Plus the physics of 100 joints and 100 colliders. It can add up very quickly. Originally the rope systems I programmed were meant for things like powerlines as seen in Half-Life. Where each rope segment was only 5-6 joints long and sort of swayed in the wind. For those kind of uses, I could see it working just fine on mobile platforms.

@davedev
Yes and No. I am not too familiar on what settings you would have to make in order for the rope to act like a rubber band. I imagine it would have something to do with the spring tension? I have traditionally just answered this question with a flat out no but I am sure there is a way for someone who is more experienced with these joint settings. Sorry for the lame answer but it's my honest answer.

@Chris12345
Grapples are sort of hard to make with QuickRopes. I was planing to make a separate script to specifically target Grapple Hooks. If I do this, I will be including it in QuickRopes and I will also be selling it separately for \$5 on the Asset Store for those who don't own QuickRopes and just want the Grapple feature.

@laurent.clave
Im not sure right off the top of my head if there is a way for you to get the tension of the rope but I will be sure and look into it sometime this weekend.

There should already be a variable to get the ropes length built into the quickropes class. Its something like "rope.RopeLength" if I remember correctly (I know its bad I dont remember and I developed the thing).

@Everyone Else
Sorry for the late responses and poor updates, I have been busy on a lot of things recently and I have unfortunately been severely neglected QuickRopes. My plan is to continue with my developments after the 2DVLS [2.7.8] update which should be sometime next week.

Looking forward to kicking butt next week and developing some awesome new things!

7. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
Thank

The new code for the tension :
Code (csharp):
1.
2. public static float getTension(QuickRope2 rope){
3.         float maxJointsDistance = Vector3.Distance(rope.Joints[0].transform.position, rope.Joints[rope.Joints.Count - 1].transform.position);
4.         return maxJointsDistance - rope.RopeLength;
5.     }
6.
Result :

test

This is average. If you happen to get any better, it's very nice!

PS : What setting do I change so that the rope is something more "flexible"?

Joined:
Jul 8, 2007
Posts:
819
9. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
can not seem to find a method or a variable to get the current value of the force.
I looked:
-ConfigurableJoint
-Joint
-Rigidbody...

10. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
What is the purpose of knowing the force? If this is a fishing game wouldn't the force being pulled on the line be equal to the force that the fish or water is pulling on the line?

Jake

11. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
In fact the strength of a fish pulls on the line, for example at the point the tip of the fishing rod to bend.
Or when you start the bait
With the solution if it is average, but I do not want to disturb you long: (

Also, I would like that when the fishing spear cane, the rope is free to the bait being thrown.
Code (csharp):
1. rope.FreeFallMode = true;
This is the right way?
Thank you very much for your help, it's pretty hard this part: (

12. ### sgoodrow

Joined:
Sep 28, 2012
Posts:
150
How would one go about attaching an object to the end, so that as the rope extends the object remains at its end?

13. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
Use the "Attach" tab

14. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
Thanks laurent for replying to that question. I did not see that question or your last post pop up in my email!

By the way, the FreeFallMode is exactly how you would do what you were asking.

I would suggest any questions you have to be sent via jake@reverieinteractive.com as I sometimes do not get a notice from the forums of a new message or I inadvertently delete the email message before replying.

Jake

15. ### laurent-clave

Joined:
Jul 18, 2011
Posts:
278
No problem
thank you Jake

16. ### KeithT

Joined:
Nov 23, 2011
Posts:
83
We have been trying to dynamically create ropes i.e. load a prefab at run time and then use it to connect 2 GOs, but have hit problems.

Has anyone tried this, got it working ?

17. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
There is a static method you can use QuickRopes.Create(gameObject obj1, GameObject obj2)

Does this method not work?

Thanks
Jake

So Steps:
3. Call the QuickRopes.Create(prefab1, prefab2) method

Last edited: Jun 28, 2013
18. ### KeithT

Joined:
Nov 23, 2011
Posts:
83
Ah ok great, had not found that. We were creating a prefab with a rope on it and then instantiating it from Resources folder, which does not work.

Will try static method, thanks.

19. ### KeithT

Joined:
Nov 23, 2011
Posts:
83
So, got the create working and have done a very simple integration with our environment, but don't seem to be able to control how the rope behaves or get it to look at all realistic. It seems to bend from one joint whatever I do and draw a straight line from that joint to the GOs on each endst
.

Have played with lots of settings and rope types. The other behaviour I can get is that the whole rope is picked up like a rigid stick. Video shows the behaviour.

What we are trying to do is get the rope to move like a cable or hose connecting the 2 objects, have a fixed length so that when one GO is moved to the end of the rope, the other GO is pulled along behind it. Is anything like this possible ?

Joined:
Aug 14, 2012
Posts:
489
I had a similar problem. After a bit of mucking around, this code seems to work:

Code (csharp):
1.
2.                 // Create Rope
3.                 m_rope = QuickRope2.Create(AnchorWall.transform.position, AnchorPlayer.transform.position, BasicRopeTypes.Mesh);
4.                 m_rope.colliderType = RopeColliderType.Capsule;
5.                 m_rope.jointSpacing = 1;
6.                 m_rope.enablePhysics = true;
7.                 m_rope.useGravity = true;
8.                 m_rope.GetComponent<QuickRope2Mesh>().curve = new AnimationCurve(new Keyframe(0, .05f), new Keyframe(1, .05f));
9.                 m_rope.ApplyRopeSettings();
10.                 m_rope.GetComponent<QuickRope2Mesh>().UpdateMesh();
11.
12.                 // Attach to objects with a joint
14.                 jointStart.connectedBody = AnchorWall.rigidbody;
16.                 jointEnd.connectedBody = AnchorPlayer.rigidbody;
17.
@Jake, please post a reply if there is a better/easier way to achieve this.

Last edited: Jul 6, 2013
21. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
@Zaddo67: Thanks, once again I did not get any notifications via email until you responded to the post.

Hope that works for you KeithT if not please let me know via jake@reverieinteractive.com

Jake

Joined:
Aug 14, 2012
Posts:
489
HI Jake,

I have been using QuickRopes for a couple weeks and love it. I am currently trying to work out how to set the springiness/stretchiness in the rope. I have been going through your scripts but haven't found if this is adjustable. Is there a setting that will control how far the rope will stretch under load.

Also, do you have a document on the properties/methods available in the script. This would be invaluable in getting the most out of this asset.

Thanks,

Tony

Joined:
Aug 14, 2012
Posts:
489
I worked it out. QuickRopes can't set the stretchiness of the rope out of the box. A quick mod is required.

Create a class variable:
Code (csharp):
1. public float Stretch = 0.1f;
Code (csharp):
1.
2.         cj.projectionDistance = Stretch;
3.         cj.projectionMode = JointProjectionMode.PositionOnly;
4.
The default value of 0.1f will allow each joint to stretch by this distance. For my situation a value of 0.04f works better. Note, this has the side effect of stiffening the rope.

@Jake. Please let me know your thoughts on this mod. Also, any chance you will write a quick reference guide for properties/methods available in quickropes.

Last edited: Jul 17, 2013
24. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
I have not had a chance to pop that code into a sample but it seems legit! I will include that the next time I update QuickRopes so thanks for the information!

I have been spending a majority of my time lately on my 2DVLS package but things are starting to calm down so I will see about making time. One of the reasons I have been putting it off though is because I have been trying to make QuickRopes cleaner and more reliable and some of the properties and methods might change in the future. But since I am not sure when that update will be I will try and find that time to make a reference of this version.

Thanks again Tony (got your email)!
Jake

25. ### claytoncurmi

Joined:
Jul 6, 2010
Posts:
168
Hi Jake,

I've bought the Unity package yesterday. I've been trying to set up a string that is flexible but not elastic. This string has two objects attached to it, one acts like a handle to move the string around (in 2D) and the other object at the bottom of the string acting like a hook. The problem is that is the string has elasticity even though I set the spring and bounce to 0 for both the twist and swing limits (I've also tried higher values to see if it makes a difference but none were noticed).

What can I do to remove elasticity completely?

Thanks,
Clayton

@Zaddo67 - Thanks for your suggestion re. the configurable joint projection distance.

26. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
I dont think you will be able to remove the elasticity completely. If you end up finding a good solution to this please let us know on the forums though!

For now, I would suggest increasing the physics solver iteration. I am not sure if that is the BEST solution but it has worked for me in the past. You can find the solver iteration by going to the "Physics Manager" pane. Here is a link to the unity documentation on that pane http://docs.unity3d.com/Documentation/Components/class-PhysicsManager.html

Hope that helps for now. Again, let us know if you find a better solution!

Jake

27. ### claytoncurmi

Joined:
Jul 6, 2010
Posts:
168
Hi Jake,

I finally managed to get a rope that almost behaves as I would like to, though the elasticity problem still remains. Now I would to enable the colliders on the rope joints. When I set the collider as sphere and press play the rope immediately starts to shake uncontrollably. I've also set the rope on a different layer and disabled the physics collision between objects of the same layer from the Physics settings.

What am I doing wrong?

Regards,
Clayton

28. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
The sphere collider issue is something I have to fix on my end I believe. It was a previous bug that I thought I had taken care of (or at least in my tests). I have a list of things I need to tend to with QuickRopes once I find the time. The issue for me is finding that time!

This lapse in updates is why I reduced the price of QuickRopes by 50% a month or so ago. But once I get some time I will work out a solution to these issues. For now it might be better to use capsules. If you have the same results with capsule colliders please let me know.

Jake

29. ### w00dn

Joined:
Apr 28, 2010
Posts:
275
Love this script! Had some initial issues with creating ropes in code, but there were some helpful posts here. Thanks!

Question: Currently with the "Mesh" option selected, you can only do tubes with x sides. It would be great if one could specify the base mesh from which the whole tube gets extruded from. Is there any possibility this being added?

There's even an example by Unity in "Procedural Examples":
https://www.assetstore.unity3d.com/#/content/5141

With this, cables and pipes and other decorative elements in the shape of everything would be possible!
see attached screenshot!

File size:
27.6 KB
Views:
1,110
30. ### BrUnO-XaVIeR

Joined:
Dec 6, 2010
Posts:
1,687
Big gravity values totally breaks this tool. It should be a bit more stable relative to that.
Is a nice pack, but is another asset I will have to mod to fit my physics configs

31. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
@woodn: I would love to add this feature in a distant future version. The key goal of the package though was to create simple ropes and cables such as power-lines and simulating crane hooks. Extruded shapes is still pretty low on the list of features. As Bruno mentioned below your comment, there are still some issues to iron out with the current version that demand more attention. Glad you liked the script otherwise though and glad you were able to find solutions on this forum.

@Bruno: I am working on it as I find time .

Jake

32. ### nab

Joined:
Aug 2, 2013
Posts:
8
I'm trying to make the rope act as a grapple hook by following the advice on

but I'm stuck on creating the rope with the minimum length and then allowing it to extend in the direction I will launch the grapple hook to until I stop it (collision) or until it reaches the maximum length allowed.

I reached the following code (the hook is a gameobject with rigidbody mass=10, and is attached to the last joint)
Code (csharp):
1.         GameObject ropeObject = (GameObject)GameObject.Instantiate(RopePrefab, transform.position, Quaternion.identity);
2.         GameObject ropeStart = ropeObject.transform.FindChild("Line_Rope_Start").gameObject;
3.         GameObject hook = ropeObject.transform.FindChild("Hook").gameObject;
4.
5.         ropeStart.transform.position = transform.position;
6.         hook.transform.position = transform.position + (transform.localPosition.normalized * distance) ;
7.
8.         QuickRope2 rope = ropeStart.GetComponent<QuickRope2>();
9.         //rope.ClearJointObjects();
10.         //rope.GenerateJointObjects();
11.         //rope.FreeFallMode = true;
12.         //rope.RebuildMesh();
13.
what methods should I use after getting the QuickRope2 component in order to achieve this ?

also,
1) which type of rope is best for what I'm trying to accomplish ?
2) if I want to use RageSpline to render the rope into 2D, is there a way to get the individual points alongside the rope to use in there ?

is there any documentation for each type of rope and the API ?

Last edited: Aug 2, 2013
33. ### anbaksai

Joined:
Aug 2, 2013
Posts:
13
Hello, Jake.

I'm developing my first game in unity and still trying to get the hang of this new environment (my past developments were 2d Android games on Eclipse).

I recently purchased quickropes and testing it. For testing, i created a very simple mesh rope with a cube attached to one end. The cube have a rigid body so the rope is being dragged by it. The problem is that there is a lot of jittering and the rope kind of stretch itself. How can i solve that?

Regards

34. ### anbaksai

Joined:
Aug 2, 2013
Posts:
13
Hello again

Nevermind the last post, i believe i´m finally starting to get the hang of this tool.

Another question:

I need to cut the rope in two when the player drag his finger crossing the rope (just like Cut The Rope). I have managed to do this with prefab ropes by simply destroying the joint that the player intersects. For the other type of ropes, however, it is not working. It launches the following error:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
QuickRope2Line.Update () (at Assets/QuickRopes 2/CoreScripts/QuickRope2Line.cs:66)

Since we are making a 2D game, the line rope is the one that suits us best (and the joints of the prefab rope looks a bit ugly beacuse it is made of simple cube objects)

Regards

35. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
Please send me an email by clicking the "Contact" link below in my signature box. I will send you a fix file.

Jake

36. ### EmeralLotus

Joined:
Aug 10, 2012
Posts:
1,352
Jake,

It seems that as more and more people are using Quickropes for many diverse applications. It would be very beneficial to include more example projects from the questions that users are asking. This way we do not have to reinvent the wheel and less work in answering the same sort of questions.

Also, in the case of fixes like the above, how can the rest of us get these fixes.

Thanks.

37. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
Please email me for the fix. I will post them to the Asset Store once I have a more suitable build.

I tried to write a better response to your request Rocki but all that came out was a rant so for now just understand that I am trying to provide as much support as my time will allow me but other than that... No comment.

(sorry a bit edgy today and I dont want to hurt feelings)

Jake

38. ### Aban

Joined:
Apr 23, 2013
Posts:
2
Ok, as I have checked the Is kinematic, it can be pulled whether it is a Rope_End or not. My another problem, is there a way to solve the question when I tightly pull or swing the two ends of a knot, the knot can still be fixed or unknoted?

39. ### anbaksai

Joined:
Aug 2, 2013
Posts:
13
Hello, Jake.

There´s an issue with the ropes and the new Unity update. Now, every time i want to create or select a rope from the GUI, Unity crashes.

Regards

40. ### Mayers

Joined:
Oct 27, 2013
Posts:
1
is there a way to instantiate my ropes? i get a crash when creating them as prefabs. and read a post Jake wrote on some
Quickrope.Create(Prefab1, Prefab2) but i really don't know how to implement this.

41. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
Guys/Gals! I hear your grumblings and I see that there are competitors in the Asset Store with very nice products. I have spent the week working on a Quick-Ropes update and I feel like I have made a HUGE breakthrough with the way joints are created and managed.

I spent the week manually adding gameObjects to the scene and manually adding joints/rigidbodies to make sure they behave as expected. Once I was able to add 50+ joints to a rope and keep it stable I translated all of that information over to script form. Now I am able to create long ropes with minimal jitter and unlike before I am able to create ropes with a length of just 1 unit that has many joints without strange curl behavior!

If you are intersted in future updates on Quick-Ropes please sign-up to my email list which can be found in the first paragraph of my homepage (www.reverieinteractive.com). Alternatively you can sign up with this direct link to the form (http://eepurl.com/IrMGP).

Look forward to hearing from you guys and I hope to have all of your issues taken care of VERY soon.

42. ### OzDave

Joined:
May 19, 2008
Posts:
144
Last edited: Nov 18, 2013

Joined:
Jul 8, 2007
Posts:
819
44. ### EmeralLotus

Joined:
Aug 10, 2012
Posts:
1,352
Jake,

Just watched the new QuickRopes 2 tutorial on youtube. This new version seems much more polished and solid. Awesome Work, Can't wait to try it out.

Cheers.

45. ### OzDave

Joined:
May 19, 2008
Posts:
144
Hi Jake! fellow Ropers!,

I have created an animation by taking an alligator tail that was animated on a green screen and isolated it to a chroma key plate.
I duplicated it, flipped it, looped it and dropped it over a still image of my game and dropped a transparent copy of the back plate so the water blocks some of the clarity of the tentacles.

I have the game setup in a Z dimension so the layering water part is fine, solved and can be acheived and was trying to convey the movement albeit a little rough but it close to what I am trying to get it to look like.

https://dl.dropboxusercontent.com/u/3053655/tentacle_concept.m4v

haha freaky but would be fun!

Jake I will append this video to an email after reading the one you sent mate.

Some Progress..

A wobble appears after some time that is not wanted across the Z dimensions, I see some constraints but do they work in 4.3?

The texture keeps resetting in the UV tiling area to 11,1 and I would like 8,2

I want the whole thing to be inverted gravity! ? any ideas on that

https://dl.dropboxusercontent.com/u/3053655/tentacle_watcher_clipped.m4v

Last edited: Nov 19, 2013

Joined:
May 19, 2008
Posts:
144
hello?

47. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
Hello! Sorry I didn't get a notification for this forum until you said "Hello"!

Restraints should still work but there are issues I am finding with Quick-Ropes in 4.3 which is why I was updating it. Hopefully I will find some time today to take a better look at your issues.

Its all slow progress because I have to update Quick-Ropes and 2D Volumetric Lights plus I have a full-time job and 16 credit hours in College to maintain! These are really big issues with my schedule so I hope you don't think I am trying to give excuses .

This weekend I will again be focusing on the updates before heading off to Indiana to visit Family for the week. Hope to have most of the issues in QuickRopes and 2DVLS solved by then.

Jake

48. ### OzDave

Joined:
May 19, 2008
Posts:
144
Hi Jake, thanks for the heads up, say hi to your mum!.

49. ### anbaksai

Joined:
Aug 2, 2013
Posts:
13
Hello Jake.

I have a question: Are you considering in one of your updates to create ropes with the new 2D physics of Unity?. I ask this because we recently created a 2D game for Android and the performance of the ropes in some Android devices was poor, no doubt because of all the 3D rigidbodies and colliders, and i heard that changing the engine to 2D improved the performance drastically.

Regards

Last edited: Dec 2, 2013
50. ### reveriejake

Joined:
Jul 8, 2007
Posts:
819
I have actually considered this but I have not really decided how to go about it. I am debating on whether it should be a separate product or mixed in with QuickRopes. It may be QuickRopes 2D or something and be \$5-\$10 since 2D ropes are much easier to make .

Jake

unityunity