Search Unity

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.4%
  2. I think its fine how it is!

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

    2.5%
  1. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Ok I will look into finding solutions to these 2 problems.

    (ClayManZ) I am aware of the problem you bring up and I have not done much to fix it yet aside from moving the code from "Update" to "LateUpdate". I will try to find a better way to reel up the rope. Thanks for pointing out that its still a problem though as I wasnt 100% sure it was fixed.

    (xadhoom) I do remember seeing this while I was developing the preview for the rope and it will throw exceptions if you enter in funky numbers. I will try to put a little safety in the script to prevent the preview from working when there is invalid data.

    New Release = Package of new problems! :) Hang in there!

    Jake
     
  2. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Acutally it is the way I am pulling the chain. I make the first like the link that is being dragged and it is pulled towards the end. Onces it gets a certain distance from the center it stops pulling that link, locks it down, and hides it before moving on to the next link.

    The problem your seeing is when the link misses its target then the joint starts abiding by its own agenda!

    ( if ( joint is less that 0.005 units from this) then ( Lock joint and move to next to move it upwards)) else (Do whatever the heck you feel like doing) <- This is the part I need to fix!
     
  3. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Also I forgot to mention something about the colliders in the preview being mismatched. I did notice what you were talking about and that is one of those things that slipped through the cracks. The method of creating the temporary joints is completely different from creating the actual joint so its a little difficult translating from one to the other.

    I will have a fix for all of these issues by the end of this weekend!

    Jake
     
  4. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    wow, your script is very powerful, thank you and best regards ;)
     
  5. bigkahuna

    bigkahuna

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

    I've got another feature request. :) Would it be possible to have an option where the rope that is generated follow a path / spline at start up? Basically you would create a spline in the editor and set that as the "shape" of the rope? The way a rope is generated now is that we define a start and end point. My idea is that we would define "x" number of points and the rope would be generated along the path those points define. The reason I mention this as this would allow us to create ropes that are wound around other objects, such as a rope wrapped around a post.

    Just a wacky idea, not sure if it's possible. ;)

    Thanks,

    BigK
     
  6. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    I have heard this idea before but to me that would be a very difficult thing to do using the current scripts. That would have to be in a 3.0 version of the script because I would need to basically re-write the entire code to accept a different method of construction.

    For now you can link multiple ropes together by assigning the pointA and pointB variables to the ends of another rope.

    PS: I know this might sound very rude but I spend many hours fixing and adding features to help people out. I have had hundreds of requests for new features to be added, however I have only received 4 donations. I DON'T mind doing this for free, but as I have said before, any donation would be GREATLY appreciated as well as give me reason to continue with this project without charge.

    Jake
     
    Last edited: Oct 5, 2010
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    That's a -great- idea, why didn't I think of that? :p I'll give that a try.

    Fair enough. I made a donation a while back and I would recommend that everyone else using this script do the same. @Jake - I personally don't think you'd be out of line to charge for the script / package. It's very polished, well executed and works as advertised.
     
  8. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    :D
    Yeah I remember! And again, thanks for that donation!

    I cannot see it fit to charge for something that I have been giving away for free for so long.
     
  9. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey guys/gals..

    I posted a 10 min video tutorial on Vimeo to show how to make a simple chain. I do plan to make tutorials to show some of the new features being released in the next version like "Sounds", "Scripts", and "Climber". I also plan to make some tutorials on using "Controls" and "Weak Links".

    LINK: http://vimeo.com/15729498

    Enjoy and let me know what I can do to improve my tutorials (Sense this is the first attempt at it).
    Jake


    Also I want to make some C# programming tutorials for advanced ideas like creating editors and stuff sense I ran into very little information on how to do that while I was creating my script.
     
  10. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    This looks great! Thanks for making it available to us.
     
  11. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Thanks Matt for the comments and the donation!

    I hope to have the rest of the new features released by next weekend. I will post an update when I do release them!

    Jake
     
  12. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! First of all, thank you for a wonderful script. Just founded it yesterday, and currently implementing in my game. I attach rope to the fishing rod. So, I have endA attached to it, endB floating freely. The problem is, when I update players animation (turning left, lets say), the endA updates only few frames later, so I can see visual gap between rod's and and ropes ends.

    So far I tried it to do this way:

    in the Update() function, I update weight of the character model to animate it.

    In LateUpdate(), I assign new position to endA.

    But that logic still fails to work smoothly. Why?
     
  13. Bububear

    Bububear

    Joined:
    Mar 1, 2009
    Posts:
    106
    Any hopes of seeing this on Unity iPhone 1.7?
     
  14. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819

    Could you try making pointB the freefloating end? I know exactly what you are talking about but I havnt really tried to trouble shoot that problem yet.

    Let me know what you find!

    @ Bububear - I do not have Unity iPhone right now, but I will try to get a sample copy so I can see about implementing it sometime in November. However, I would imagine that unless your using 5 joints in your rope, the performance would be bad.

    Sorry,
    Jake
     
  15. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    So I wanted everyone to know that my website has been down for several days now due to some issues on the server at FreeServers. So in response to that issue, I went ahead and switched to GoDaddy and uploaded Wordpress and I am now back online!

    You can now SEE the rope script in a webplayer by going to the following:
    http://reverieinteractive.com/?page_id=11

    You can also now download the rope script by visiting:
    http://reverieinteractive.com/?page_id=9

    You can catch updates now using the RSS feed link. I will most likely post update on my site before posting them on the forums.

    Hope you guys find the new site a little more pleasing to the eye!

    Also I am going to be uploading more tutorials in the near future. The tutorials will be basic at first and will be a mix of video and text (Depending on the tutorial size). You can catch those under the "Tutorials" tab!

    Thanks again for everyone's support on this project!
    Jake
     
  16. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    It was already free floating. I'll have few ideas and will try them, modifying original rope script. I'll let you know if I find a solution, thanks!
     
  17. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    I meant PointA.

    I was thinking maybe PointB and the final joint are really disconnected...

    Jake
     
  18. Bububear

    Bububear

    Joined:
    Mar 1, 2009
    Posts:
    106
    Thanks Jake. Not to sound flattering, but your script looks absolutely amazing.
     
  19. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey, one can never be too flattering ;). Anyway, thanks!

    I will be working more on the script this weekend trying to get all of the newest features implemented and clean my code up a bit more so everyone should look for that probably early Monday morning (in the am PST).

    Thanks again Bububear,
    Jake
     
  20. fremachuca

    fremachuca

    Joined:
    Oct 13, 2010
    Posts:
    26
    checked out your tutorial on vimeo. this is just awesome! thanks!
     
  21. PvtHudson

    PvtHudson

    Joined:
    Oct 8, 2010
    Posts:
    20
    The simple bridge demo looks nice. Good job
     
  22. xadhoom

    xadhoom

    Joined:
    Sep 2, 2010
    Posts:
    91
    Hey Jake,

    Very nice webpage! Looking forward to the upcoming version.

    Thank you for your hard work!

    xad
     
  23. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    You're welcome Jake. Thanks for the hard work you've done on this.

    I'm looking forward to seeing the new features/tutorials!
     
  24. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Thanks guys!

    @fremachuca : I hate talking in the microphone... It feels so weird, but it turned out pretty good! Thanks for watching!

    @PvtHudson : Yeah that was a super simple scene I had on my desktop and the whole reason why I changed hosts for my website was because my previous host did not want to support .unity3d files so I threw that scene up there to test it out and to show off an upcoming tutorial that is going to (hopefully) be in Unity Creative magazine.

    @xadhoom : The site was actually a template from the WordPress templates selection. I will probably change the theme a couple times before I find one I really like. Also, I dont know if you read the post but I HOPE to have the script ready on October 25th, but I do have to work over the weekend so I am getting nervous about that release date!

    Thanks again guys,
    Jake
     
  25. acs_andrew

    acs_andrew

    Joined:
    Aug 26, 2010
    Posts:
    26
    Another noob here. Want to thank you for the script it looks great.

    The thing I'm trying to do is rotate a drum and have the rope attached to it at a point so it wraps around it. It's probably my lack of knowledge/experience but what would be the best way to approach this?
     
  26. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    The best way is to parent the "PointA" object to the drum (Where the drum is the Parent and "PointA" is the child). After that, offset the "PointA" so it is not colliding with the drum.

    Just a heads up though, Ive done this before with the script and the rope acted kinda weird if your links are heavy. I guess you can play around with the settings but my recommendation is make the links light, use a capsule collider for your drum, add a near frictionless physics material to the links (Find that under the "Physics" or "Joint" tab. not sure which lol)

    PM me or email me if you have any troubles,
    Jake
     
  27. rosenkrantz

    rosenkrantz

    Joined:
    Oct 6, 2009
    Posts:
    40
    Thanks Jake for this great bundle. It have helped me a lot in my new efforts to get something done. I feel stupid asking this, but how do I work with this using scripting. I want to instantiate custom ropes run time? Do you have any sort of documentation? Or script guide? Again, great job and nice implementation and also, excuse me for sounding so stupid.

    What is your email? Looked around for it but could not find it.

    Best regards
     
  28. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Hey, I will be sure to include some methods in the next release for you so you can instantiate custom ropes but for now, I think the best bet is to say:

    Code (csharp):
    1.  
    2. GameObject go = new GameObject("name");
    3. Rope2 rope = go.AddComponent<Rope2>();
    4.  
    5. rope.pointA = new GameObject("pointA");
    6. rope.pointA.transform.parent = go.transform;
    7. rope.pointB = new GameObject("pointB");
    8. rope.pointB.transform.parent = go.transform;
    9. rope.ropeDetail = 50;
    10. rope.ropeWidth = 1.5f;
    11. //.... So on.....
    12.  
    I am not at my computer right now so I cannot really tell you if that would work or not, but let me know if it does... If it doesn't, then you may have to wait until Monday's release before I can help although I will try to come up with a solution later tonight.

    Jake
     
  29. immFX

    immFX

    Joined:
    Mar 20, 2010
    Posts:
    110
    ...or you just have the rope gameobject inactive and then you set active=true when the time comes ;)


    Jake, such a great script! I will surely donate.
    Be sure to include a rope prefab in your next release, I can't get it to work exactly right.
     
  30. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Ok I will throw in a few prefabs including a bridge!
     
  31. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Just curious... What would you guys like for the CreateRope method to look like?

    All return a gameObject:

    LineRender mesh type
    CreateRope[positionA, positionB, detail, ropeWidth, material, colliderType]

    Prefab mesh type

    CreateRope[positionA, positionB, detail, ropeWidth, prefab, upDirection, prefabScale, colliderType]

    Mesh mesh type
    CreateRope[positionA, positionB, detail, ropeWidth, meshSideCount, colliderType]
     
    Last edited: Oct 24, 2010
  32. immFX

    immFX

    Joined:
    Mar 20, 2010
    Posts:
    110
    This looks adequate to me, Jake.
     
  33. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    Your script is really nice and I love it. Just one question, how do you make it less bouncy and shorten the length of the rope?
     
  34. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Cant really help on the bounciness because its more to do with either your physics settings or the PhysX engine itself.

    I can help you with length though, inside the ropeobject gameobject in your scene, you will find 2 more objects called "PointA" and "PointB". Just move those to wherever you want, and it will adjust to span between the two.
     
  35. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    I did. I put a sphere and made it fixed. Then I put a box on the other end. But when I played the scene, the box was hanging so far down that it looked like it was not attached. It still was attached but it was so far away from the end of the rope... I put a picture so you can see what I mean... What is wrong there?

    $Screen shot 2010-10-24 at 1.25.59 PM.png
     
  36. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Interesting find!

    I see what is happening.. If you know how to edit code add the following at line 633 of Rope2.cs:

    Code (csharp):
    1.  
    2. cJoint.anchor = Vector3.zero;
    3.  
    so lines 632-635 will look like this:

    Code (csharp):
    1.  
    2. CharacterJoint cJoint = joint.AddComponent<CharacterJoint>();
    3. cJoint.axis = jointSettings.CJoint_axis;
    4. cJoint.anchor = Vector3.zero;
    5. cJoint.swingAxis = jointSettings.CJoint_swingAxis;
    6.  

    Also make sure your cube doesnt have any colliders attached to it.

    If you are not comfortable editing the code, then I will have the fix in the next release which I hope to make public tomorrow (except its making me nervous sense ive found a few new errors sense).
     
  37. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    I know how to edit code. But at line 632 in Rope2.cs I have " #region Temporary Rope Display...." not "CharacterJoint cJoint...".

    On the other hand, on line 415, I have that "CharacterJoint cJoint...".

    Do I have a old piece of script? I downloaded it off your site in the downloads section recently... :(


    EDIT: After plugging that code into line 415, it works perfectly. Thanks. But why is yours in line 633 while mines is in 415?

    EDIT #2: Also, is there a way to have the cube still have a collider? Because I need one for my game... :(
     
    Last edited: Oct 24, 2010
  38. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Quesiton 1: Yes I forgot I have a highly altered version ;) It is the next release which hasnt been released yet lol... Sorry about that,

    Question 2: Yes you can have a collider on the cube but the rope setup is a little bit more complex. Does your rope have to have colliders? If not, then you will need to do the following:

    Create a second object as your "PointB". One that isn't your cube.
    Go to "Attach" settings in the rope properties and add a new attach point.
    Assign the cube as your attached object.
    Assign the joint index to as high as it will let you (this will be the end of the rope)
    Position the cube just a hair below the end of the rope so you can avoid all of the colliders.

    That should work and I will warn you that you might need to mess around a little bit to get it looking just right.

    Also, sometimes you have to add a little magic to your game to hide technical errors like this. When I made a cube that needed to be at the end of the rope I made a hook in the center that was just geometry without a collider.. That way the rope appeared to be attached to the geometry without interfering with the colliders!

    Hope you get it working, give me another post if you dont!

    Jake
     
  39. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    I tried it. Didn't like the results. The thing didn't look as smooth.

    Any other workarounds? Could you change the way the script works to allow us (all developers) to allow our points to have colliders?

    I love your rope script by the way. Keep up the good work.
     
  40. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Yeah I will try to throw in a control that allows you to disable certain colliders by joint index.
     
  41. Andrew Greenwood

    Andrew Greenwood

    Joined:
    Oct 13, 2010
    Posts:
    6
    Such a this one is good site for the information about the rope script and this through get the good information about the script...
     
  42. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
  43. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    :p

    When is the next update coming out?
     
    Last edited: Oct 26, 2010
  44. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    It is coming I promise, I am working on it as we speak!

    :)
     
  45. MikezNesh

    MikezNesh

    Joined:
    Jun 18, 2010
    Posts:
    37
    Awesome. Bump!
     
  46. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Dont you dare bump me.... jk

    This release will be the best, dont worry!

    I am going to go ahead and just say not to expect it until the end of this weekend. The main reason I didnt get it done last weekend is because I ended up working over the weekend at my regular job! But this weekend I will have all the time to finish!

    Jake
     
  47. acs_andrew

    acs_andrew

    Joined:
    Aug 26, 2010
    Posts:
    26
    Your regular job? Where're your priorities? ;)

    Looking forward to the new script. Better to be right than right now. :)
     
  48. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    It will be done right! Trust me... Actually this version was re-written from the ground up in order to clean up some of the code, fix some of the issues, make it easier to build ropes, and to help incorporate future features!

    Also, it seems like some of the issues that were happening in the previous version are now taken care of in this version thanks to the re-write.

    hope to provide for you guys!
    Jake
     
  49. viejodani

    viejodani

    Joined:
    Nov 10, 2009
    Posts:
    5
    Thank you so much for your script! we find it very useful.

    We would like to ask you about what should we do about this situation:

    We want co create a realistic, destructible spiderweb (not very detailed), and we find this script to be right for the job to emulate the web's behavior (specially when it's breaking). We create "weak" spots that will break a few segments of the web (identified by a different object), and we connect these spots with the rope script.

    The problem is that when we tie two different ropes to an object, one of the rope breaks and the entire system falls down and we get a lot of errors.

    Can you give us advice on how to make it work? thanks
     
    Last edited: Nov 2, 2010
  50. nezitx

    nezitx

    Joined:
    Nov 13, 2010
    Posts:
    1
    Is there a way to "grow" a rope behind an moving object?

    I apologize if this has been answered somewhere, but I couldn't find anything about it.

    I was wondering if I could use your rope script so that when my player object shoots a harpoon object, a rope/chain can trail along behind it. I don't even need the rope to do anything except look like a rope, but problem is I'm not sure there is a way with your script to "grow" the rope in that fashion. I just started playing with the rope download and watched your tutorial so I figured I'd ask here.

    Thanks!