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:
    308
    It's for 2D physics, if you want to create rope for 3D games, than you can find other 3D rope tools on asset store.
     
  2. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    Ok thanks, it is not a 3D game. It is 2D using 3D physics, because the 2D physics are not full featured yet.
     
  3. jays99485

    jays99485

    Joined:
    Nov 2, 2014
    Posts:
    4
    Hi Temo

    First of all your 2D Rope System is Awesome ,million thanks to you for the great asset , but i have

    a little query ,Is it possible to achieve the swinging effect of object ( here in screenshot cup

    cake from Cut the rope game ) after cutting one rope .

    Please find the attached screenshot
     

    Attached Files:

  4. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hi,
    I'm glad my tool helped you. Thanks for such kind words ;)
    What do you mean in swinging, doesn't it swing now after the cut? Do you need specific movement on curve or something like that?
     
  5. jays99485

    jays99485

    Joined:
    Nov 2, 2014
    Posts:
    4
    Thanks for the quick response ,
    How can i attach more than one Rope to Candy (like in Cut the Rope game)
    Please share your Email Id .
     
  6. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    You can connect as many end points as you want. Haven't you seen the video? (in first post) There is shown how the tool is used. You choose the point A& B and the rope is created between them, second time select the other end point and candy and you'll have 2 ropes. The documentation is included in project folder, there is written my email ;)
     
    Last edited: Nov 20, 2015
  7. Steve L

    Steve L

    Joined:
    Dec 23, 2014
    Posts:
    4
    Hi Fierce Blaze,

    I have recently purchased your rope system but I couldn't manage to attach the rope to my main character as u show above. Every time I press play it breaks. Can u tell me how I can make this happen?

    with kind regards
     
  8. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hi Steve,
    I'm the developer :)
    If you don't want to make chains breakable, just remove "breakable" script on them.
     
  9. Flybye

    Flybye

    Joined:
    Mar 25, 2015
    Posts:
    100
    Hi Temo,

    In my game I currently have a fast moving object with a "rope" I created attached to it made up of about 40 or so joints and sprites. I had to increase my timestamps in order to make sure all the joints and sprites stay together since the fast moving object they are attached to was tearing the joints apart. My problem is it hurts mobile performance in doing so.

    I noticed in your demo your ropes seem to be stretching the texture. Does this mean your ropes are far more efficient than how I made a fake rope out of many joints and sprites as I did in my game?

    Basically, I am curious if your rope method is less CPU hungry than manually making a rope with many joints and sprites.
     
  10. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hi Flybye

    This tool uses Unity's standard 2D physics. Chains are sprites with rigidbodies and are connected to each-other with joints.
    This tool is for time-saving, to not waste time in assembling each chain manually also contains character controller for rope (climb up/down) and cut/break abilities.
    I don't know exactly how you assembled your ropes, but logic seems same.
     
  11. Flybye

    Flybye

    Joined:
    Mar 25, 2015
    Posts:
    100
    Yes it sounds exactly the same.

    How do you prevent your ropes/chains from breaking?
     
  12. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    There is no any tricky things. Physics calculation is heavy and if you add lot of physical objects on scene, of course device won't be able to calculate it fast enough, fps will drop down and weird things will happen.

    If your fps isn't low, but rope still doing weird things, then increase position and velocity iterations in physics 2D settings (menu: Edit > Project Settings > Physics 2D)
     
  13. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Hey man. I tried Easy Ropes 2D, and while it is a great product, it was not my cup of tea. (It has a lot of dependencies, it increases compile times exponentially, etc).

    So, I am thinking of buying your rope system... Or maybe make my own. I was wondering a few things.

    Is there a way I can peek at the documentation before buying?
    Do you have any callbacks when the rope breaks? So I can register, and then OnRopeBreak (For example) I can add an a particle, or create an action based on that.
    Do you have a way to decrease the number of joints to create tight bridges?

    And, not necessary. Do you have spring simulation for stretched Ropes? If not, no worries, not needed.
     
  14. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hi Milo_del_mal,

    Yeah, here you can see the documentation: https://www.dropbox.com/s/zkd19bxfplb7air/2D Rope System Documentation.pdf?dl=0

    There is already implemented particle instatiation and sound playing when the rope is broken or cut. You get whole source code, so you can easily change it with your liking.

    Rope is assembled with prepared chain prefabs. How many chains is necessary from point A to B is calculated from sprite width. So you can scale up prefab to control how many chains do you want per rope.

    There is no stretching ability for now.

    Thanks.
     
  15. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    Hello.

    I have recently purchased this asset and am having a bit of trouble. I have a balloon that I want a rope to attach to so the balloon carries and object. Initially I just had a hingejoint2D connected to and object and the balloon pulled it just fine.

    However, when I connect the balloon to the object with the rope editor, both objects stop moving when the game starts. Both of them have rigidbody2D on them and the balloon has a constant force up. Any advice on how I can get the balloon to move up and the rope pull the object? Thank you.
     
  16. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hello Cryo,
    Seems after connecting them, end points (ballon, object) are set to "isKinematic" in Rigidbody2D component.
     
  17. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    I was just about to reply with the same XD
    Anyways thanks for the help. Is there a way to make it not automatically set the isKinematic to true?
     
  18. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    In "Rope2D.cs" script search these lines and comment them:

    pointA.GetComponent<Rigidbody2D>().isKinematic = true; (line 85 and 269)
    pointB.GetComponent<Rigidbody2D>().isKinematic = true; (line 174 and 369)
     
  19. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    Hello, Thank you for the help. Great support.
    I have one more question. I am using the Runtime rope creator, but it is making 2 ropes at a time.
    How do i get it to only make one rope between point A and point B?
     
  20. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Thanks, I'm at your disposal ;)
    Have you tested scene "Rope Test 3"? It creates 1 rope at a time, when you press "C" key.
    Are you using touch input or something other logic to create rope? Seems that's the problem.
    For example writing input controls in "FixedUpdate" function causes them to run multiple times.
     
  21. Malik-Basit

    Malik-Basit

    Joined:
    Dec 5, 2012
    Posts:
    5
    @temo_koki I just purchased your asset. Thanks for the great package.

    i am creating rope in run time and i want unbreakable rope. I do not see any setting/variable for unbreakable ropes in "RuntimeRope" script. Please tell me exact place where i can remove "Breakable" script from each chain object. or is there any other way ?

    I also want "Chains Holder" object created at run time to be child of my game object. so i can move the parent object with rope.

    Thanks
     
  22. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Hi @Malik Basit, thank you for choosing my asset.

    Just remove "Breakable" script from the prefab, which you're using for rope creation.
    To make "Chains Holder" child of any other game object won't behave well.
    To make rope follow the object, you need to child starting point (point A) to your game object.
    For example in scene "Rope Test 3" child "tack 1" to "player" object.
    You may need to increase "position iterations" value in "edit -> project settings -> physics2d" settings to make physics calculations more accurate.
     
  23. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    I actually just made a silly mistake to cause the double ropes. I placed the 2 objects as point a and b but also put their parent object as points holder. Removed points holder and now it works.
     
  24. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    Hello. So Another strange problem is occuring. I have the rope at point A attached to a balloon with a constant force up, and at the other end the rope is attached to an object the balloon is supposed to carry. The thing is, the rope keeps jittering quite a bit. any advice?
     
  25. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    May be balloon and chain (at connection position) colliders are the problem, may be they are stuck in each-other and try to distance themselves, but they can't as they are connected with joints.
    Fix: In "Layer Collision Matrix" disable collision between them, manual link:
    http://docs.unity3d.com/Manual/class-Physics2DManager.html

    May be the object is very heavy and that causes weird behavior. To make rope more stable you can increase position & velocity iterations.

    If those aren't the case, then if you'd like send me the project on my email and I'll take a look.
     
  26. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    @temo_koki Thanks for the help. I already disabled any collision between the rope balloon and weight components, so that should not be a problem.

    I have increased position and velocity iterations now. It does help as there are no large jerks anymore, but there is still shaking. The more I increase the iterations the less it is visible, but I am wondering how that would impact performance, as this is a mobile game. Currently I have 15 iterations of position and 15 iterations of velocity. I just don't want the game to eat up the player's battery.

    oh and thanks for the help you provide :)
     
  27. NikitaVr

    NikitaVr

    Joined:
    Aug 25, 2013
    Posts:
    8
    Oh as a side note, I think there is an improvement that can be made on the cutter. If you use the cutter, it does not move the the finger's position right away when you start swiping, so if an object is where the cutter was before, it will get cut as well even if you did not swipe there.

    I will fix this on my end by just keeping the cutter far off screen while it is idle. You can see if that is a good solution for the general case.
     
  28. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    @Cryo Thanks for the note ;)
    Abut iterations... it isn't specific to my tool, it just creates chains using Unity's standard rigidbodies and joints. In general when you have lot of physical objects you need to calculate their position and velocity more frequently to make them stable. So, it's about balancing between iterations and physical objects count.

    Best regards ;)