Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Procedural Rope System

Discussion in 'Made With Unity' started by SpookyCat, Mar 26, 2011.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Hi All
    First test of a rope/wire/hose system I've been working on this week. Uses our own soft body physics system to model the rope behaviour. The mesh produced can either be a fully procedural rope mesh with twists, strands end caps etc or a custom cross section or a mesh can be provided to be used to build the end mesh. The uv mapping can be altered as well. Various constraints can be added ie to attach the rope to an object. Also the rope can be made to collide with the environment. A webplayer can be found at Here Esc key for options. The rope is to the left in the scene.
    Chris



    [video=youtube;dHqmrjgXy68]http://www.youtube.com/watch?v=dHqmrjgXy68
     
    Last edited: Mar 27, 2011
  2. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    914
    looks pretty cool, how's the performance?
     
  3. bradjensen68

    bradjensen68

    Joined:
    Feb 2, 2009
    Posts:
    274
    Best looking rope yet. Very realistic!
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Nice start. I've created a number of different variations of rope scripts (as well as used the one created by Jake) so this is always a topic that interests me. Although yours is pretty, I don't understand why some objects seem to effect collisions while others don't. How does yours handle very long lengths, going around pulleys, and being under tension (pulling)? Those have been issues I've run into with every rope script I've tried so far.
     
    Last edited: Mar 27, 2011
  5. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,561
    This is seriously cool, wow!
     
  6. psyclone

    psyclone

    Joined:
    Nov 17, 2009
    Posts:
    245
    Looks really good.. One of the best ropes Ive seen so far.

    Question though... does the rope take into account physical objects and collision boxes?
     
  7. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Thanks All :)
    The objects the rope collide with is defined by a layer. The rock trees etc are part of the scatter system and in the demo dont produce colliders, so its just colliding with the ground and the bumps. Iam working on self collision and improving the collision system generally, the rope can get snagged very easily which I guess could be desired behaviour but also nice to have the option. The system has no problem at all with very long ropes, the physics system we use has a constraint method built in to keep the system stable and be able to handle big loads. One of the constraints that can be added is a pulley constraint, hope to have that working very soon.
     
  8. zine92

    zine92

    Joined:
    Nov 13, 2010
    Posts:
    1,347
    Looks nice
     
  9. Cominu

    Cominu

    Joined:
    Feb 18, 2010
    Posts:
    149
  10. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,285
    Will you consider custom mesh for it, to allow the building of metalchains in example?
     
  11. xiaoq0903

    xiaoq0903

    Joined:
    Mar 29, 2011
    Posts:
    3
    Uses our own soft body physics system to model the rope behaviour.
    Do you mean that you use your own physics system not use the unity's physics?
     
  12. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Chains added. And yes I used my own physics system for the rope.


     
  13. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Added a webplayer to show the chain working, press O to get options and slide down the dialog to change the link size. Still got self collision and a bit of tweaking to do. Not enough hours in the day :)
    Chris
     
  14. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Nice looking scene, but all the image effects cause serious graphics errors on my machine (MacBook Pro, x1600 graphics, 10.6.7).

    $DOF error.jpg
     
  15. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    That's an odd looking result you are getting there, does that happen only with the DOF effect or does each effect on its own cause problems?
     
  16. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Each effect causes a different problem, but all of them occur in the top 1/3rd of the screen.
     
  17. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Anyone else seeing the issue bigkahuna is having, want to try and track down if its computer type, card type or maybe driver issue to try and help me fix the issue. How much video memory do you have on that system by the way, almost looks like a VRAM memory issue, perhaps Iam not checking I get a valid handle.
     
  18. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    My MacBook Pro has a Core Duo 2 cpu and 256 MB of video RAM. Seems to work fine on my Windows 7 machine (i5, Windows 7 Home Premium 64 bit, nVidia GeForce GTS360M with 1 GB graphics RAM built in, 1 GB of system RAM used by graphics).
     
  19. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Thanks BigK. Going to have to dig up a Mac Book from somewhere now :)
     
  20. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Spooky - If you need a beta tester, let me know. I'm between projects and am helping a couple other folks out with their testing.
     
  21. xiaoq0903

    xiaoq0903

    Joined:
    Mar 29, 2011
    Posts:
    3
    How do your physics system work with unity? Is it a dll or just code in unity with its script language?
     
  22. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    In this case its written in C# as one of the intended platforms is mobile.
     
  23. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    This would be cool with snakes too!
     
  24. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    :D Finally someone else who is willing to take on the all mighty rope lol.

    Looks VERY nice!
     
  25. mateusbello

    mateusbello

    Joined:
    Jun 2, 2011
    Posts:
    15
    Im on process of creating a rope for my game but yours looks pretty nice.

    Where I can get it?

    Using this rope is possible to attach it to other game objects and slice it (like when cut by a scissor) and end up with 2 smaller ropes?

    Thanks
     
  26. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    @mateusbello - Hey I am working on a new version of my rope system. PM me and I will make sure to write you back!
     
  27. soapstar

    soapstar

    Joined:
    Apr 4, 2011
    Posts:
    56

    Hey jj55ee, glad to hear you are working on a new version of your rope! What will your new version include? :)
     
  28. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Not sure yet how all of it is going to work together. Rope seems to be a very difficult thing to provide to people in a way that people can use it easily and include features they want. The main focus of the ropes is going to be the ability to swing on the rope and cut the rope. The ability to shorten and lengthen the rope at run-time might not happen in this version but I have no official word on the truth to that.

    I'm happy to spend a lot more time on the rope stuff if there is more interest and that seems to be the case at times!

    Jake
     
  29. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I've been messing with ropes in Unity for a long, long time. I think my first attempt was way back during the Unity 1.x days. There are lots of issues to deal with, none are easily overcome and I think that's mostly due to limitations in PhysX. If you want realism, you'll have to add your own physics (as SpookyCat has apparently done), but that's another level of sophistication most of us aren't able to deal with and it usually involves a serious performance hit. I've gone the direction of simplifying my rope scripts as much as possible for maximum performance and then modifying the behavior of the other objects in the environment so that everything seems to behave properly, instead of getting the rope to do everything. Admittedly not the best approach but it seems to work.

    @Jake - I think the biggest problems I had with your rope scripts were all related to the editor scripts (and not the actual rope scripts), which relates to your "making it easy to use" comment.
     
  30. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    Wonderful rope SpookyCat. Looks fantastic. Maybe consumes a bit too much resources. Can't you simplify it to make it run faster?
     
  31. shiyal73

    shiyal73

    Joined:
    Sep 14, 2010
    Posts:
    3
    HI,
    Can you explain how to use this in my game please, i have some unclear points there.

    1. how to apply texture on this rope ?
    2. what is the role of each parameter in rope modifier ?

    thanks
     
  32. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    @TiG - Sorry for the delay in responding. How are you judging the resource use? Not sure it needs speeding up the rope part runs very well plus the system is fully configurable as to time step number of masses etc. The physics side is used in my Rope Deform modifier in MegaFiers and that runs well on mobile devices. Click the image to see a video and description of params etc.



    @shial73 - Just checking, are you confusing this rope system with the Rope Deform modifier in MegaFiers, if so a description of all the params can be found by clicking the image above. If not the rope/chain system here will be released in the MegaMesh system coming soon and that will have a complete list of all params when released on the webiste. You will be able to apply a texture just like any other object for example. If that doesnt answer your question and you need a description of the system here then let me know.

    Chris
     
  33. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
  34. shiyal73

    shiyal73

    Joined:
    Sep 14, 2010
    Posts:
    3
    Hi spookycat, I can't understand your statement, there is rope system and rope deform modifier is different ? if yes can you say some detail please. (sorry for my english)
     
  35. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    The rope in the first posts of this thread is a custom rope and chain system that I haven't released yet, the rope bridge system in my last post is a modifier for my MegaFiers system. If you are currently using the modifier version then the if you click the image of the rope bridge you will be taken to the help page for that modifier which explains what all the params do, and as for adding a texture you dont the modifier will deform any mesh you give it so you just build your mesh object like any other with whatever materials you want etc and then apply the modifier.
     
  36. sgttravers

    sgttravers

    Joined:
    Jul 18, 2012
    Posts:
    1
    Any word on when this rope system will be released?
     
  37. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    I am in the process of adding the system to our MegaShapes system at the moment so first release is not far away.
     
  38. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Just a little post to say the first alpha of the rewritten rope and chain system has now been added to the MegaShapes system on the Asset store.
     
  39. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Can you tell us what has been changed, or better yet, include some screenshots / video of the new rope/chain system?
     
  40. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    I have been re writing the core physics system and adding different integrators such as Verlet and VertetTC , I have also added self collision which was lacking from the previous version, a new system for calculating the transport frame to stop ugly twists in the mesh and adding new meshing options such as being able to use a custom mesh as the model to be deformed to the rope path, so you can build a rope mesh with eyelets or other additions, or model up a hose system for a robot and use that for rope, still lots to do but getting there. Quick grab of rope test below.
    $ropetesta.jpg
     
  41. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    @SpookyCat Looks good! I am curious to see your physics implementation in action but I am wondering why you decided to rewrite the physics engine?

    Jake
     
  42. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Hi Jake
    Well I already had a softbody physics system I had written for our own game engine, so I decided to port that instead of using rigid bodies and joints as wanted to make it as fast as possible for general use and allow custom integrators to be added as well as custom constraints. It does make life a little more complex in having to do ones own collision detection and interaction with Unity rigid bodies but it does allow us to have complete control over the physics as well as allowing multi threaded support.
    Chris
     
  43. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    We have just released an update for MegaShapes, this sees some bug fixes and some improvements to the rope system bringing it a little closer to Beta. We have added a Verlet integrator for the rope as well as the start of self collision and another meshing option where you can deform a custom mesh to the rope spline, this would allow you to have a complex mesh with multiple materials and may say eyelets at each end for example. A new test scene is also included in the package which will show of the rope systems and we will add more examples to this scene as features are added. A video of the test scene is below, nothing special yet but shows the self collision.

    [video=youtube;2eHm3OI9a9o]http://www.youtube.com/watch?v=2eHm3OI9a9o
     
  44. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Very impressive. Have you done any "stress testing" to see how big, long or many ropes you can use before the system starts to get bogged down?
     
  45. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    The system is being tested by a customer at the moment though the rope is still in alpha and has a lot of optimizing to do they are getting good results, i will be doing a more intensive demo for the next update which should help show the speed of the system and we will eventually be adding mutlicore support to really get the most out of the code.
     
  46. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    Quick update to say the Verlet integrator has been improved in the latest update to the system.
     
  47. Train

    Train

    Joined:
    Apr 22, 2008
    Posts:
    344
    The rope video looks very good. Well done!
     
  48. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Any updates / improvements to this? I'm considering buying MegaShapes just to get the verlet rope capability but haven't seen any updates or videos in a long while. Is development dead?
     
  49. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Bump: Any news on a release date?
     
  50. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,488
    @Zaddo67 - The rope and chain system is included in the MegaShapes package so is available now.
     
unityunity