Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Rope Script V2 now availiable - 8/08/10

Discussion in 'Made With Unity' started by reveriejake, Nov 19, 2009.

?

Should I continue to support this script

  1. Yes I need this script and appreciate your support!

    94.2%
  2. I think its fine how it is!

    3.5%
  3. I know enough about programming to fix it myself!

    2.3%
  1. casey945

    casey945

    Joined:
    Feb 16, 2009
    Posts:
    46
    Dear jj55ee,
    im using your Rope_Script Scripts,import your ComplexRopeDemo.unitypackage,I got this error:

    Assets/Rope Scene/Scripts/Rope2.cs(319,36): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

    please help me,Thanks.
     
  2. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Im not quite sure why you are getting this error. I downloaded the scene and ran without any problems. Try downloading the latest version when I upload it tonight.

    Sorry,
    Jake
     
  3. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
  4. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey Just a quick update. There was an issue with the first release on Unity version 2. The issue was an error "CS0202". I have released 2 separate versions of the script to fix the issue, one for U2 and one for U3.

    Jake
     
  5. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Some of the unity packaged scenes are not working properly so you can create a new scene and follow this tutorial:

    http://vimeo.com/13995322


    Good luck guys/gals!
    Jake
     
  6. Dwair

    Dwair

    Joined:
    Jun 13, 2009
    Posts:
    11
    Testing it right now!

    I'm sure it'll be easy to setup even on iPad ;)

    Thanks for your hard work, I promise to donate for this useful development :D
     
  7. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Thanks and hopefully this works well for your projects!

    I am expecting a few bugs here and there though ;)

    Jake
     
  8. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Havn't heard any bad or good news about the script. Please, if anyone has any issues or praises. I would like to hear from you!

    I would love to think the script is this good but I have serious doubts lol.

    Jake
     
  9. ClayManZ

    ClayManZ

    Joined:
    Apr 30, 2009
    Posts:
    26
    I played around a little, but the scene with the two cranes would fit better to my plans.
    Do you consider releasing it too?


    Well, I like it, so I donated 5 minutes ago.
     
  10. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey thanks for the donation and I will try to get the crane scene updated with the new scripts and posted to my site before tomorrow night.

    Also there are still a couple of errors that I am aware of which should hopefully be fixed also by tomorrow night.

    Jake
     
  11. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Ok just wanted everyone to know that the crane package is available on my downloads page as "UPACK (U3)". That also includes the newest version of the rope script and editor which now allows you to attach objects as well as taking care of some of the errors and issues that were in the previous version.

    Also I am looking into including the ability to hit an "Update" button in the help file which will automatically update your scripts without having to visit my site. I am not sure if that's possible yet but if it is then look for that feature in most of my scripts.

    Everyone Enjoy!

    Jake
     
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Just imported the new package into U3b5 and got this warning:
    Code (csharp):
    1. Assets/Rope/Assets/Scripts/Rope2.cs(167,16): warning CS0414: The private field `Rope2.jointBreakPoint' is assigned but its value is never used
    2.  
     
  13. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey I forgot about that one. But I provide the jointbreakpoint variable to allow programmers to access which joint in the rope broke. That's probably not going to change as long as the ropes continue to work ok.


    Do your ropes still work?

    Jake
     
  14. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey I forgot about that one. But I provide the jointbreakpoint variable to allow programmers to access which joint in the rope broke. That's probably not going to change as long as the ropes continue to work ok.


    Do your ropes still work?

    Jake
     
  15. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    I'm just trying your test scene for now. Seems to work pretty nicely actually. :)

    I noticed that if I swing the ball around so that it wraps around the boom it sometimes passes through the boom. I've run into similar issues with the physics engine and smaller colliders passing through larger colliders. Have you found any way of preventing this? The only way I've done it in the past was to max out the physics settings and make the colliders on the chain -much- larger than real life.

    Also, have you given any thought on how we could lengthen the rope/chain dynamically (ie. make the chain longer / shorter while playing the game)?
     
  16. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Yeah I am going to be playing around with that soon!


    I was wondering if everyone who uses this script is using the editor? You can find it by going to "RI Editors" -> "Rope Editor"..

    It should look like the picture below. If it doesnt then you probably have an out of date version.

    Jake
     

    Attached Files:

  17. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Yes I am. That's one of the nicest things about this script is its flexibility and simple it is to use.
     
  18. platonia96

    platonia96

    Joined:
    Mar 10, 2010
    Posts:
    225
    Amazing! :wink:
     
  19. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Ok cool! I was wondering about the ease of use!

    Anyone think of anything else I can make (practical) let me know! I was thinking of maybe making a way to make rope bridges next, but I am kinda ready for a break from rope stuff lol.

    Jake
     
  20. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Hey Jake,

    Looks good, well done! Very neatly organized with a very well done example project. The only issues I've run into so far have all been due to limitations of PhysX / Unity joint behavior.

    One question though, did you update the script again since my last post? I noticed that the download's folder is dated 8/14 but the package is dated 8/13.

    Thanks again for sharing this very cool work!
     
  21. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey thanks again for the compliment.

    If the zip file you downloaded is titled "Rope2-U3-081410-FILE.zip" or "Rope2-U3-081410-UPACK.zip" then that is the latest version.

    Also if your editor looks different from the one above then it is out of date.

    I am going to post one more update tomorrow night but then I am going to try to take it easy on the updates from here on out! I am assuming that updating all your folders everyday is getting annoying ;).

    There is a known error on the latest version of the rope script. If you load Unity and open the rope editor you might get a Warning message that shows every frame. To fix that for now create a new rope object using the editor and it will fix the error. The version I am uploading tomorrow has this fixed.

    Jake
     
  22. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Will you be implementing the ability to lengthen the chain/rope while playing?
     
  23. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    lol no not yet... Be patient my friend! I have an idea of how I am going to do that but I havn't really had much time to play around with it.

    I will defiantly get a chance next weekend!

    Jake
     
  24. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Ok update V:081710 is up for Unity3 and Unity2 users.

    Next release will include the rope length adjustment. But I am not going to make any release date promises ;).

    Remember to let me know of any errors in this version! I dont think there are any but I am never too sure.

    This version will also notify you of any further updates. Just click the "Help" at the bottom and if there is a new version it will say so right at the bottom!

    Jake
     
  25. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
  26. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Jake - FANTASTIC! The rope pull / push are very realistic and nicely done. Have you done any experimenting with ropes that are less stretchy/elastic? That's what I want to test next.
     
  27. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Hey thanks! Glad you like it.

    I havn't played with stretchiness yet because I am assuming it has something to do with the physics engine. I did include the slider to set the physics iteration. It seems like the higher that setting is, the less stretch you get.

    Jake
     
  28. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    One question for you, how do I set a "maximum length" for the rope? It seems that it automatically sets the maximum length to wherever the wrecking ball's transform is at the start of the scene. How do I make it so it can be longer than that?

    You've done a very nice job on this. The more I play with it the more I appreciate how clean and easy you've made this to use!
     
  29. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    The ropes length is set buy the length at awake. So move the wrecking ball to however long you are wanting it to be, then check "Start Raised" and it should work.

    I am planing to add a little more later like max length, min length, and wind to link index but for now its just set by the length at awake.

    I impressed my self with the ease of use ;). I have used it every day sense I released the first version. Its amazingly simple.

    Here is a screenshot of a scene ive been working on today using some rope script action!

    :) Again glad you like it!

    Jake
     

    Attached Files:

  30. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Yes, I think that's all it needs to be complete.
     
  31. ClayManZ

    ClayManZ

    Joined:
    Apr 30, 2009
    Posts:
    26
    Well, great!

    <edit>No, AWESOME!</edit>

    But I found a problem:
    I have updated your last example (crane) with the latest scripts and played around a little. If the crane is rotated more than 90 degrees +/-, the rope behaves odd if it's pulled (key alpha1). It doesn't pull, the rope is moved somewhere. Pushing it (key alpha2) works and brings the rope back into its right position.

    Here is a screenshot:
     

    Attached Files:

  32. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    [SNIP] I Spoke To Soon....

    I am still looking into it :)

    Jake
     
  33. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,377
    Can't say how glad I am to see this project still alive, and, still getting better! Jake- you sir, are a personal hero of mine :D

    I was following this awhile back, ADD kicked in and went off to other pursuits...lol...and have cycled back. Turns out I need to make a sail-boat sim in Unity, and realistic cables + ropes (er, lines), would really bring it to life. If the ropes could even provide physical use...:D

    Anywho, great to see, and will be back once the model is ready!
     
  34. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Hi Jake,

    I just tested the latest posted scripts on my new Windows i5 machine and it's working very nicely. I love the "broken link" effect, very convincing!

    Edit: One more suggestion, could you add an option to alter the rope's rigidbody settings to accomodate the new 3.0 "Collision Detection" options? That way you could set this to "Continuous Dynamic" for very precise physics collisions.
     
  35. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    Yes! And actually that was originally included in the earlier releases but I for some reason or another commented the lines out. I think it had something to do with the person who was requesting a version for Unity 2.6 And I just never remembered to un-comment it!

    I will update that next time I release.

    Jake
     
  36. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,546
    Jake I cant seem to get the "Grab hold of rope and swing" thing to happen, is there any chance you could share how you did that? I cant seem to get it with either std assets fps or rigidbody fps.

    Thanks-its a great project, I'm glad to finally have a chance to dive in.
    AaronC
     
  37. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
  38. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Hi Jake,

    This is really an amazing piece of work. Would it be possible to add a toggle button for the work-around we discussed yesterday? I know it's a bit of a PhysX hack, but it works and I'll probably use it in the future. Also, good idea about hiding the inspector view. I'm so used to editing values in the inspector that I've often caught myself editing the script's values there. This helps remind me to use the editor. Good idea!

    BigK :)
     
  39. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
  40. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Ok cool, I hadn't realized you already did that. Thanks! :)
     
  41. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    That webplayer is pretty cool. The Scene 2 really shows how efficient the whole thing is. I had 600+ chains in the scene and it still ran smoothly on my aging MacBook Pro.
     
  42. GC_Cryss

    GC_Cryss

    Joined:
    Jun 10, 2010
    Posts:
    9
    Hey! Been checking out this awesome Rope demo for a while; looking at implementing it into my code, too, but I have a quick question.

    I'm trying to hook up the rope between two draggable objects. It'll look like a wire, basically, a kind of lose wire. I would like the user to be able to grab the ends of the wire, to attach to things, but it seems like whenever I attach the rope to the two objects, then go to drag one, the rope starts flinging around wildly if it's stretched Too far, or too close to the other object.

    I'd like to have a max length, so the person cannot drag any further, too. Any clue how I might be able to work that one out? Thanks!
     
  43. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    (@ GC_Cryss)

    I had originally thought about creating this sort of "Clamp" that your talking about, but it initially caused some interesting things to happen so I postponed it and eventually forgot to implement it. I will add your request to my list of requests and see if I can get it into the next release of the rope script.

    For now, could you make sure there is a physics material assigned to the objects your trying to pull which gives a little less friction? Also, could you maybe lower the mass of the object that you are pulling?

    Jake
     
  44. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    @GC_Cryss - The issue you're seeing is caused by a limitation in Unity's (PhysX) joint physics. I played around with this last weekend and it looks like if you keep your object's weight no heavier than 100x the link weight it will work (assuming no drag/friction). So in addition to reducing friction, you may need to reduce the weight of the object you're trying to move (or increase the weight of each link).

    @JJ55ee - This sounds a lot like what we were talking about the other day, eh? ;) I was also thinking about how one might be able to "grab" any link in the chain, and then pull it. One idea was to invoke Rigidbody.IsKinematic = true when a grabber comes in contact with a link and then make it a child of the grabber. Just an idea...
     
  45. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815
    You are actually able to grab the links in that demo I provided above. I was using the drag rigidbody script and it works perfectly!
     
  46. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Which script is that? You mean the one in the standard assets? I'm experimenting with 3.0 at the moment, I'll see if that one works.
     
    Last edited: Sep 28, 2010
  47. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    815


    Yeah the stock script in the Standard assets bundle. I think its called "DragRigidbody" or something like that.
     
  48. xadhoom

    xadhoom

    Joined:
    Sep 2, 2010
    Posts:
    91
    Hi jj55ee,

    A few things about your latest release. If I create a rope in a new scene I get exceptions like this (while the rest still works somehow):
    Code (csharp):
    1. (Filename: Assets/Editor/RopeEditor.cs Line: 361)
    2.  
    3. NullReferenceException: Object reference not set to an instance of an object
    4.   at RopeEditor.DrawPhysicsSettings () [0x00000] in C:\Development\Unity\RopeTest\Assets\Editor\RopeEditor.cs:361
    5.  
    6.   at RopeEditor.OnGUI () [0x003cd] in C:\Development\Unity\RopeTest\Assets\Editor\RopeEditor.cs:137
    7.  
    8.   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception)
    9.  
    10.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
    Sometimes he also creates a lot of TempLink objects while in edit mode. I fear that something is screwed up here due to this exception...

    It seems that the colliders are not oriented correctly in preview mode (180 deg around global y-axis?).

    Using unity 3 Pro :).

    xad
     
  49. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    I think I remember running into this too. I think it happened, as Xad says, when I first clicked on the option to create a new rope. Then once I edited it and put in the required fields it worked fine. In fact, I experimented with it extensively yesterday and it worked very nicely. :)
     
  50. ClayManZ

    ClayManZ

    Joined:
    Apr 30, 2009
    Posts:
    26
unityunity