Search Unity

2D Rope & Bridge System

Discussion in 'Assets and Asset Store' started by temo_koki, Mar 23, 2014.

  1. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    $2D Rope System scrn.png
    Showcase Video


    This package contains scripts for creating any type of 2D ropes in editor and at runtime.

    Also contains scripts for dragging objects, cutting and breaking rope, playing sound and instantiating object at break/cut position, making character climbing and swinging on rope and object pooling system to save memory at runtime rope creation.

    Scripts are heavily documented to understand how every little detail works.

    Current features:

    $2D rope editor window.jpg

    • Multiple points support to create objects between points with one click
    • Connect end points if multiple points are used
    • Instantiate objects between point A and B
    • Option to lock end objects
    • Option to connect end objects to point A and B or one of them
    • Option to hide end objects, useful when connecting to A, B points
    • Option to use linerenderer
    • Set linerenderer's material and width
    • Runtime creation
    • Create rope with delay between object creation at runtime
    • Script for breaking, depending on angle distance between objects
    • Script for cutting
    • Script for dragging
    • Ability to limit break/cut count per rope
    • Play sounds and instantiate objects at break/cut positions
    • 3D mesh support

     
    Last edited: Jun 3, 2014
  2. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,145
    Wonderful !!!
    "bridge system" : Does it mean a character can walk on a chain that will have a rope bridge effect !?!
    Can a character climb ? Will you include scripts for climbing or holding the ropes ???

    6R
     
  3. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Thanks.
    Yeah any 2D physics based character can walk on it. Unity's 2D character love it very much :)
    Holding rope is already possible, you can child pointA-B object into your character transform and that's it.

    $rope test.gif
     
    Peter77 likes this.
  4. FierceBlaze

    FierceBlaze

    Joined:
    Mar 24, 2013
    Posts:
    6
    Pretty sweet but it's got a strange little reaction when you click once on the screen, wait click someplace else... it acts like a slice.

    Maybe you should check how much time has passed first.
    Or if there is a mouse up event between slices then end the slice.
    It's just weird.

    Nice code though, it's on my wish list. I just hope it's priced right.
     
  5. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,145
    Thanks for your reply. Perfect example !!! (Funny !)

    6R
     
  6. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    @FierceBlaze
    Yes, it was trailrenderer's problem, fixed already. Thanks.

    p6r
    I realized, that I didn't answered you fully :)
    About climbing... I think it's character controller programming, everyone will need their own, but I'll add simple climbing script to show how it's done.
    And about holding rope... I tested and unity's 2D physics (4.3.1 version) doesn't work as 3D ones. Object attached 2D Rigidbody component doesn't follow its parent when isKinematic is set to true, so I added simple script to change transform for such objects, works perfectly :)

    $rope braid.gif
     
  7. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,145
    Great to know...
    Ha ! Ha ! Good example again with the chain on the head !!! A very dynamic effect !

    6R
     
  8. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    42
    This looks great and is exactly what I need at the minute. Is there a release date?
     
  9. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Thanks. I think will finish it in 2-3 days, but I don't know when it'll be available. I sent 2D ragdoll creator extension, in March 15 and it still isn't reviewed, so I can't give you release date.
    You can see that extension here, may be you'd like that too :) http://forum.unity3d.com/threads/234299-2D-Ragdoll-Creator
     
  10. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    It is now available on asset store. Updated demo scene, showcase video and asset store link is above :)
     
  11. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
    I really like that tool but it seams that doesn't work perfectly even on video sometimes it doesn't catch cuts, in demo sometimes you need to try 3 -4 times to cut rope fast, and I don't like how it destroy chunk of rope/ chain instead of just cutting it, that way you can cut couple times and nothing will left and fall :)

    I like the idea of growing rope from point A to B, would be great if this could also stick it to point B :) and option to stretch and not break ropes like in "cut the rope" could be very useful.

    need little bit refining and could be really handy tool :)
     
  12. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Cut is done on trigger exit, so I did some delay between second cut to not cut same rope twice, you can lower that delay value if you need faster cutting

    For me it seems more logical and realistic to hide broken chain. Of course if you cut rope many times there won't be chains left, but you can limit whole scene cut count as well as per object cut count. Also you can create rope with small objects, so when hiding cut chain it wouldn't be noticeable.

    Yes you have options to decide which point to stick. In scene 3 I have set to not stick on pointB.

    You also can create non breakable rope. When creating rope you need to enter chain object which won't have break script attached. In these scenes chain object prefabs have break script attached.
     
  13. createdream

    createdream

    Joined:
    May 29, 2014
    Posts:
    1
    I want to know your plug-in, after the character impact the rope grab the rope, swinging with the rope, the rope is still stable.
    I use cocos2dx realized almost all, but in character with the string after the collision, box2d physics engine cannot well simulate the effect of the rope, the rope at the same time there are broken. Hope can get your help
     
  14. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    Sorry, I can't understand what do you want exactly.
    Have you bought this plugin and it doesn't work as you want or you want to buy it and are interested in some options?
     
  15. Ylex

    Ylex

    Joined:
    Apr 9, 2012
    Posts:
    13
    Can this be used with Unity version befor 4.3, or only with new sprite system?
    I kind of like the old system for making 2D games, with planes and textures instead of sprites.

    Also, I noticed in the demo that the rope does not stop vibrating after the character jump from it. Can this be adjusted?
     
    Last edited: Jun 2, 2014
  16. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    This is done in Unity 4.3.1 version, so asset store won't allow you to download it from lower version.
    You can use sprites and meshes too.

    What do you mean in "vibrating"? Do you want to stop swinging and freeze the rope?
     
  17. Ylex

    Ylex

    Joined:
    Apr 9, 2012
    Posts:
    13
    Yes, to stop swinging and freeze the rope. Can it be done?
     
    Last edited: Jun 2, 2014
  18. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    I even haven't thought about such logic :) I'm curious why do you want it? if it freezes it won't look like a rope :)
    But if you want... the rope is assembled with standard rigidbodies (chains) and you can iterate through them and make their "isKinematic" true.
     
  19. Ylex

    Ylex

    Joined:
    Apr 9, 2012
    Posts:
    13
    I just want the rope to return slowly to it's initial position when a character jumps out of it after swinging. Now it swings forever when he leaves it, like there's no friction and gravity. It should not be like that cos the force momentum should leave the rope together with a character. So it doesn't have to freeze completely, just to return to natural position.

    Maybe now I explained better? Or maybe it's already like that but I haven't used the demo properly. Or just my great english stops me from explaining, sorry. Not a big deal anyway, thanks :)
     
    Last edited: Jun 3, 2014
  20. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    You can increase drag coefficient for chains in rigidbody2D component
     
  21. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
  22. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    305
    What's the performance like on mobile?
     
  23. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Rope is bunch of chains assembled with Unity's standard 2D physics colliders and joints, nothing special, so it depends how many chain object will you have on scene.
     
  24. junzy

    junzy

    Joined:
    Oct 26, 2013
    Posts:
    2
    How can I smoothen the climb? Right now my player does a sort of jerky motion upwards the rope
     
  25. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Player is connected to chain, so more small chains means more smooth motion on the rope.
     
  26. URselfIsHere

    URselfIsHere

    Joined:
    Sep 24, 2014
    Posts:
    1
    Hi Temo,

    I have a question for you. Is this plugin made using 2d Physics objects or Physics object(3D)? I am looking at various rope and bridge simulating plugins that are readily available in asset store.
    My objects in the world use Physics 2D objects so I wanted to make sure that all the objects in my scene follow the same Physics element.
    Thanks,
    URself
     
  27. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    This uses Unity's 2D physics (colliders, joints), so, you won't have any problems ;)
    Thanks.
     
  28. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
  29. BD54

    BD54

    Joined:
    Feb 16, 2014
    Posts:
    3
    Hey Temo

    First of all I would like to say I love your 2D Rope System. It works very good. However I've noticed an issue in my project while using your system.

    I want to attach a rope (string) to a balloon. whenever I move with this balloon the distance between the connected gameobject and the first chain is becoming really big.

    I've send you my project (simplified) via PM.

    Could you please help me out with this?

    Kind regards
    ~monserboy


    ~~~~~Solution~~~~~
    After I had contact with Temo he pointed me at my position iteration count in my Physics 2D settings. After chaning this value to a higher number the problem was solved.
    He also pointed me at the way I handled the movement of the balloon (through Transform) and said I should take a look at his Rope Test 1 scene so I could make it better.

    After tinkering a little bit with my project it seemed that (along with Temo's suggestions) I also had to change some Update methods to FixedUpdate (to let them use the physics step cycle).
     
    Last edited: Oct 15, 2014
  30. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    Thanks for kind words. Of course, I'll check it now ;)
     
  31. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    Hi, i just started working on your 2D Rope system. I am using the bridge of this system to make a car game. It works fine and seems static while car is moving on it. It should be a little more elastic than default. Where are the settings for it?

    Regards
    Talha
     
    Last edited: Oct 15, 2014
  32. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    You can change angle limits for each chain in their Hinge Joint 2D component and that will make it more elastic or straight.
     
  33. ebohdas

    ebohdas

    Joined:
    Aug 9, 2013
    Posts:
    1
    Hi
    Could you tell me how to implement an rope length increase (runtime adding chains), I want to make something like - spider moves to the bottom releasing webs
     
  34. Kaji-Atsushi

    Kaji-Atsushi

    Joined:
    Oct 6, 2012
    Posts:
    234
    Would this solution work for lets say a rubberband type bridge? Where you can pull on the rubberbandy-bridge, and the character could potentially launch from it by the bridge being pulled. Much like a slingshot.
     
  35. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    I'm sorry, that's not possible to increase/decrease chain count at run-time.

    This system uses Unity's standard 2D physics and joints (hinge joint 2D), they have little bit stretchiness, but you can't manipulate that option, so I fear you can't achieve what you want.
     
  36. babgev88

    babgev88

    Joined:
    Apr 1, 2014
    Posts:
    4
    Hi Temo how can I change the length of the rope and make it non breackable
     
  37. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    Do you want to change rope length at run-time for already created rope? Rope is created between 2 or more points, so distance between them is the length of the rope.
    To make it non breakable just remove breakable script on the prefab which you're using for creating the rope.
     
  38. babgev88

    babgev88

    Joined:
    Apr 1, 2014
    Posts:
    4
    I just want to change the length of the rope betwen two points in editor not in runtime to make it more extended
     
  39. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Of course, you can. You have to place point A & B where you want them and the rope will be created between them.
    Have you seen the video (included in first post) ?
     
  40. babgev88

    babgev88

    Joined:
    Apr 1, 2014
    Posts:
    4
    "1" is a picture taken in runtime and "2" in taken in editng stage i want the rope in runtime be like the rope in editing stage(like a line ) and a few thiner 1.png 2.png
     
  41. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Ahh... Clear.
    It's natural, because in editor physics doesn't behave and chains aren't pulled down by gravity. What you can do is to lower angle limits for chain prefabs and perhaps increase position & velocity iterations in Edit->Project Settings ->Physics 2D
     
  42. babgev88

    babgev88

    Joined:
    Apr 1, 2014
    Posts:
    4
    I can not get what I want with these advices please say another way
     
  43. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    If you want it straight like a stick, I fear it's not possible in Unity's 2D physics. Try to move end points little bit away from chains, that'll give you small difference.
    BTW, I forgot to answer about thickness. When you check "Use Line Renderer", there you can see "width" field. If value isn't entered there than it's taken from prefab width which is used to create chains.
     
  44. adi99123

    adi99123

    Joined:
    Feb 6, 2015
    Posts:
    5
    I am building a 2.5d platformer. will 2d rope work with 3d character or Can your mechanism of rope works for 3d rope and climbing ?(I know some coding)
     
  45. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Unity's 2D & 3D physics doesn't interact to each-other. If you'll have 3D meshes with 2D colliders, it will work.
     
  46. lyh1091106900

    lyh1091106900

    Joined:
    Apr 17, 2014
    Posts:
    13
    it looks great .I am curious how it works , the rope be broken when the role jump second time.
     
  47. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Thanks,
    Rope chains have "break.cs" script attached, which detects distance between chains and if it's more than max distance, it breaks.
     
  48. Dj_Zuczyslaw

    Dj_Zuczyslaw

    Joined:
    Mar 20, 2014
    Posts:
    31
    Hmm, in "Rope Test 3" Demo Scene when I press space to jump - character don't want to jump :(:(:(. He only jump when is on the rope (I moved him "manualy" in scene view to rope position).

    Edit: OMG, nevermind, I added layer named "ground" and it work perfect now :). I always wrong "tag" with "layer" … :p

    This asset is very fantastic :).
     
    Last edited: Apr 20, 2015
  49. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    309
    Hi,
    Great that everything works fine for you, thanks for kind words ;)
     
  50. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    How well will this work without Rigidbody2Ds? Using regular Rigidbodies. Also will it still work fine of both ends of the rope are connected to non static transforms? IE an asteroid to a rocket?