Search Unity

Ultimate Rope Editor - New powerful rope physics for Unity3D [RELEASED]

Discussion in 'Assets and Asset Store' started by UGTools, Feb 11, 2013.

  1. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Currently if you make a rope breakable it can break in any of its joints. You can make a script on Start() where you set all joint breaks to Mathf.Infinity minus the one you actually want to break.

     
  2. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    You have 2 options:
    -Create an extensible rope that goes just from E to F (and have some sort of fake static modelled line that goes from A to E)
    -Create an extensible rope that has a coil at A, a segment Node at E and the end point at F.

    You can make the line so that it extends or gets back to E, but for the physics required to do it at high speeds you would need to have a very high number in the fixed time step.

    As for the fishing rod bending, I can't help you with that, those physics are not rope related and you would have to do that yourself :-/

    Tell me at what point you are and I'll help you with the setup

     
  3. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    hi .. i have a small problem...

    when the game starts....the procedural rope is invisible....but when i select the option procedural again..the rope becomes visible....


    can you help with this.... so far i have tried to restart the rope and trigger extensible bool through script....but no use...

    any suggestions would be helpful !! stuck with this this...

    another thing is when i run the game in editor the script reset is working and the rope becomes visible....but when the windows build is taken..it stops working and the rope just falls to the ground and keeps going down....
     
  4. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Hi aCat4mIndia!

    Why is it invisible when the game starts? Have you set this property somewhere?

    Could you please tell me a bit more about what you are trying to do so I can picture the scenario? Also If you can send me an example project it would be very helpful.
    If your rope falls maybe what happened is some exception was thrown. You can check the output_log.txt file for errors, or send it to me as well.
     
  5. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    hi..

    i have a prefab of a vehicle...with the rope in it.....when the game starts the vehicle prefab spawns and the rope is invisible....

    when i trigger the regenerate function through script the rope respawns and it is perfect....the problem is...this works only in the editor....

    when i take the build and run...this causes the rope to fall through the ground....in the standalone build....
     
  6. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Aha! I see, it's not invisible it's just that the rope nodes are elsewhere because the vehicle was respawned to another location. Regenerating the rope is a good way to place it again, but if it has a different behavior in the standalone build I suspect an exception was thrown.
    Did you try to open the output_log.txt? It should be in the data folder that is in your .exe (YourProject_Data\output_log.txt). Try opening it and looking for errors and tell me if you find something.
     
  7. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    oh okay..thanks...i'll check it out and update you...
     
  8. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    i check it now....there are no text files in the build folder....
     
  9. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Not in the build one, but in the data folder that is in the same folder as the .exe.
    In the same folder as the .exe there should be a folder called EXENAME_Data and inside there should be an output_log.txt
     
  10. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    yea searched in each and every folder inside it...the data ... it has some mono folders, and .assets files etc....searched each one of them....
     
  11. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Try running the .exe with the following commandline:

    file.exe -logFile mylog.txt
     
  12. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    if i keep regenerating the rope keeps on falling on the ground...no text file found anywhere...sorry..any other suggestions ?
     
  13. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Without any other hint it's difficult to help. Can you send me a sample project?
     
  14. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    i went to build settings and enabled the player log.... and i seemed to find some exceptions in my scripts and some unnamed scripts....it pointed to line number 1592...i guess it could be your UltimateRope Script....

    i can even forward you that log file....i'll try to create a sample project.... pls ping me if you need any other info in the meantime...
     
  15. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Yes please, forward me the logfile (info at ultimategametools com).
    Thanks! With the sample project it should be easy to spot :)
     
  16. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I took a look at the logfile and there seems to be something going wrong when you instance the prefab, a script/component is reported missing. I'll check it with the sample project, it should be easy to track down.
     
  17. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    oh thanks..it will be very helpful...as the rope is a critical part of this project.....thank you


    and one more thing which i have noticed is...when the rope joints are attached to a moving object....they are fine until a certain speed....but after that they start to move behind the vehicle ....and when the vehicle stops...they just come back and attach as normal....
     
  18. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Do you mean they stretch too much? Try to increase the Link Joint Max Force and Link Joint Spring values, and the solver iteration count, and if that doesn't help maybe you need to lower your Fixed Timestep (Edit->project settings->time). But don't do it unless it's strictly necessary.
    I'll take a look at the project anyways and see if I can help.
     
  19. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    i think..we will skip the stretching for now....cause i have modified to a minimal level.....so no prob now....

    the only issue the old one where the rope is falling below the ground....i'll keep checking after some time....

    thank you....
     
  20. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    There is some component missing in the prefab which you keep referencing when you instance it. I can help you solve it if you want.
     
  21. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    yea sure....i need the fix....
     
  22. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I would need the sample project for this. It would take no time to find the error.
     
  23. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    hi...

    i'll setup a sample project asap and will send you....

    thanks
     
  24. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    I have sent the sample project....

    thanks for the help...
     
  25. Yorick2

    Yorick2

    Joined:
    Jan 24, 2009
    Posts:
    297
    Hi,

    We make realistic simulators involving ropes fairly ofter. We have our own system for ropes based on QuickRopes which does the job but has problems.

    The biggest problem we have with ropes is that the strength of the joints is dependent on the mass of the rigidbodies.
    So it is impossible to make a rope with a mass of say 20kg which holds an object with a mass of 20.000kg The joints will simply stretch when you try this.

    We end up having a rope of 150kg and an object of 1000kg. And in that setup the mass of the rope influences the movement of the object much more then it would in real life.

    Does the Ultimate Rope Editor have a solution for this problem?
     
  26. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Hi Yorick2,

    The source of this problem is the physics engine that Unity uses (PhysX by nVIDIA). Most of it works quite nice and does the job well, but the joint implementation is terrible:
    -Joint strength depends on the two connected object properties, which is not the case in real life of course.
    -If you put them under some stress, they can move out of their positional/rotational limits.

    I've done realistic simulators myself for the last 8 years, mainly related to heavy construction/demolition/mining machinery, and have used PhysX in all of them. Most of the time spent on physics always had to do with finetuning weights, forces and other parameters so what you're telling me sounds very familiar. Sometimes you find yourself working not with the actual values, but with values that mimic realistic behavior better :)

    Now, if you want to do rope physics and have them interact with the scenario and other rigidbodies the only primitives that PhysX (and thus Unity) provides are joints. Because of this the Ultimate Rope Editor also uses joints internally and even if they are a pain in the ass sometimes we tried to expose enough flexibility through the parameters to make the finetuning process as easy as possible.
    Some of the editor users are in fact simulation companies -most of them using the rope editor for cranes- and have been quite happy so far.

    Of course I can't guarantee 100% that it will perform exactly as you like, I can't know that, but what I can guarantee is that you can't get a better result unless you implement your own rope physics system, but in that case it wouldn't be able to interact with the scenario.

     
  27. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    You're using a very old version of the Rope Editor, get the last one. The standalone version build had a bug that didn't create the joints at runtime when you called Regenerate() and this is exactly what is happening to you.
    Also, is there a reason why you omitted the editor scripts? There should be a script called UltimateRopeEditor.cs in your:
    \Ultimate Game Tools\RopeEditor\Editor\ folder
    Unless you have this script the actual editor won't show up and you won't be able to hit the button that creates the rope. That's why it doesn't get created unless you call Regenerate() :)

    Hope this helps
     
  28. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Yorick2 - Another simulation developer here. ;) UGTools is right, most of the ropes available for Unity are using PhysX joints which quite often fail miserably when using "realistic" dimensions and masses. The only other possible solutions are to build a separate rope system within Unity (as SpookyCat appears to have done here) or use a different physics engine (as buestad appears to have done here). SpookyCat's solution is pretty resource intensive so only works with short ropes. The project buestad is working on looks promising, sure would like to see it in the Asset Store. ;)
     
  29. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I didn't know about this last one. The problem is you are basically importing a whole different physics engine into unity that works, but is incompatible with Unity's own physics system, primitives (colliders, rigidbodies, joints, etc.) and core. Ideally you would want to mix both, but I'm afraid that's not possible. So basically you are using another physics engine for an isolated scene and using Unity just to render it :)

    I've been following the first one for quite some time now and as all of Chris's work it has a superb, polished visual result. I am a fan of his attention to detail. But as far as I know it's still a test and there's no actual real-world scenario demos. I'd like to see it moving fast in a crane scene for example, interacting with other dynamic objects, or put under stress and snap. The scenes are really beautiful but the rope just moves slowly and doesn't really show any advanced interaction features.

    The problem with using your own physics is you can't exchange information between the two systems (Unity and your own). You can of course wait until the next frame and do some basic overlap testing, but each physics system has its own internal states and computations and even their own inner loops with collision testing that are not accesible.
    If two different engine objects (let's say a box handled by Unity and a crane cable handled by your own physics system) are both interacting at the same time with the crane hook what happens there? who has the authority?
     
  30. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    hi..

    were you able to make any progress in with the sample project i sent you....
     
  31. Gloop

    Gloop

    Joined:
    Jun 18, 2013
    Posts:
    1
    Are updates included with a purchase?
     
  32. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    You probably missed my post. I answered you already (link) :)
     
  33. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Yes, in fact there have been updates already with bug fixes and feature requests through these forums and e-mail.
     
  34. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Yup. Part of the reason I'd like to see more projects like this one.

    There was a demo some time back (don't remember which thread had the link) that had a simple, coiling rope and some other objects that literally crawled on my machine (probably was a Core Duo). Impressive to see but way to slow for anything of substance.

    Yup. Too bad UT never developed PhysX cloth any further, that might have been another possible solution besides using joints. Unfortunately the cloth implementation was so weak it really didn't work for ropes at all.
     
  35. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I think that doesn't make much sense unless you use it for really small projects or tests. "Importing" an external physics engine into Unity would be terrible for medium/big projects and also for future compatibility. There are too many Unity elements, assets, external plugins and probably your in-house technology that relies on the built-in physics components to consider taking that path. And you never know what changes Unity will introduce in upcoming versions.
    What is exasperating is the time it is taking Unity to incorporate PhysX 3.x. It has been already available for ages and has an incredible amount of improvements (including a new joints solver) over the version that Unity uses and which is years old.
    If we had GPU rigid bodies and a solid joint solver I think I could die in peace...
     
  36. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I've not had an opportunity to try it so I wouldn't know. Besides the Bullet Physics project I was contacted by another company who "claimed" to have developed a very "high end" physics engine that they claimed to have gotten to work with Unity. I've not seen a demo yet so it could just be vapor ware for all I know.

    Amen. ;)
     
  37. Rezzolution

    Rezzolution

    Joined:
    Jan 16, 2013
    Posts:
    4
    Hey great plug-in! One question, though.. What is the best way to create a rope at run-time? I'm trying to implement a swing mechanic into my game where the player can swing from buildings (think spider-man 2), but I'm kind of at a standstill when it comes to actually creating a new rope at run-time. Any pointers would be greatly appreciated.
     
  38. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    I probably would create a rope in edit-time to fine-tune its appearance, physics etc. Then press "delete rope" and make a prefab out of it so you only need to instance it at runtime.

    At runtime you would need to:

    -instance it:

    Code (csharp):
    1. ropeGameObject = GameObject.Instantiate(ropePrefab) as GameObject;
    2. rope = ropeGameObject.GetComponent<UltimateRope>();
    -assign the length parameter: (you can do it by computing the distance between the character and the target point for example)

    Code (csharp):
    1. rope.RopeNodes[0].fLength = Vector3.Distance(amazingSpiderMan.transform.position, target.transform.position);
    -assign the start and end:

    Code (csharp):
    1. rope.RopeStart = amazingSpiderMan.transform.position;
    2. rope.RopeNodes[0].goNode = target.transform;
    -Call rope.Regenerate()

    Code (csharp):
    1. rope.Regenerate();
    Make sure you've got the latest version downloaded from the asset store. There was a bug some time ago which affected runtime generated ropes.

    Also, this only will work if the object that hangs has a rigidbody component and its kinematic property is set to false when he shoots the web so that physics take over.
    Using the rope editor for this is quite tricky though, you may want to go for a mixed solution instead of relaying 100% on physics.
     
  39. Rezzolution

    Rezzolution

    Joined:
    Jan 16, 2013
    Posts:
    4
    Awesome! Thank you for the speedy reply! I'll let you know how it goes.
     
  40. Rezzolution

    Rezzolution

    Joined:
    Jan 16, 2013
    Posts:
    4
    Perfect, man! Thank you so much I've got it working how I need now! I'll admit that I was working on a "not up to date" version of your plug-in (just because I wasn't sure if it would work for what I needed), but I just purchased it from the asset store after finding that's not the case! $45 well earned sir thank you so much for making an amazing plug-in!
     
  41. TimBorquez

    TimBorquez

    Joined:
    Mar 18, 2013
    Posts:
    81
  42. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    No problem, I'm glad you liked it. Thanks for the support! :)
     
  43. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
  44. MoravenSoshir

    MoravenSoshir

    Joined:
    Jul 3, 2013
    Posts:
    10
    Are these ropes suitable for use as a grappling hook that a character could swing from? Or would it have the typical problem with joint solving where the joints become too separated before being corrected back?
     
  45. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    Yes, in fact it's currently being used in at least a couple of games this way. No problems so far.
     
  46. MoravenSoshir

    MoravenSoshir

    Joined:
    Jul 3, 2013
    Posts:
    10
    Awesome! Really glad to hear that, thanks :)
     
  47. duckie028

    duckie028

    Joined:
    Jun 26, 2013
    Posts:
    3
    I noticed that you can't turn off the gravity for a link. I want my rope to not automatically drop to the ground and I want some segments to remain in the air for a bit longer. Any idea on how to do this?
     
  48. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    You can select all rope links (the child gameobjects of the rope) and set their gravity parameters all at once.
     
  49. duckie028

    duckie028

    Joined:
    Jun 26, 2013
    Posts:
    3
    But it resets that use gravity when it gets enabled.
     
  50. UGTools

    UGTools

    Joined:
    Oct 10, 2012
    Posts:
    738
    It only should happen if:

    a) The rope gets regenerated (usually by changing some of its parameters, or by manually pressing "reset rope" or "delete rope").
    b) You have got the "persist after play-mode" still checked.

    If you've created the rope and have all final parameters correctly set you shouldn't need either a) or b) and you can set the gravity you want.
    But if it bothers you I can create a script for you that allows you to set this parameter, or an extra parameter in the rope editor.