Does Anyone Know How To Animate A Winding Rope?


https://forum.reallusion.com/Topic433725.aspx
Print Topic | Close Window

By Lord Ashes - 4 Years Ago
I'm looking to animate a rope that is attached to a winch on one and and an object on the other end. I want to animate the winch winding the rope and pulling the object closer.

First Attempt: I started with my Physics Enabled cable which is basically a number of segments that are physics joined together with a non-physics shell to make the cable look solid. It is a cable that I am selling on my Marketplace and it has the advantage (over soft cloth) that it can be attached to multiple objects. However this idea failed because the spaces between the physics joints (which are normally not visible due to the mesh cover) allow the cable to pass through the winch axle as the cable is wound-up when I animated the winch.

Second Attempt: Create the winch and rope as soft cloth and make the winch hard cloth and the rope soft cloth. I could not get that working either. Either the winch would fall or the rope was stiff.

Obviously a solution would be to forget about physics and make a long segmented cylinder with bones for each segment so that I could pains-takingly animate the rope manually...but that seems like an incredible about of work.

Any solution that I might have missed or is  the slow and steady manual animation of rope segments the way to go?
By 4u2ges - 4 Years Ago
It might be possible with Super Bone Editor plugin (Python based) https://forum.reallusion.com/415100/Super-Bone-Editor-Plugin?PageIndex=1
Or flex tube https://forum.reallusion.com/424631/So-I-am-finally-getting-somewhere-with-a-flexible-tube-that-will-hold-its-shape-while-bending?PageIndex=1 (I'll try tomorrow to see if it's feasible)
By Rampa - 4 Years Ago
4u2ges, that locking mechanism you came up with might work for one, or both, of the ends. But it can just be pinned with black at one end.

I also did something like that where I locked one end of the cable. The upper ends of the cable are enlarged to lock into a receiver. They do break away pretty easily though!




By 4u2ges - 4 Years Ago
I was too intrigued to wait till tomorrow Smile
This is possible, but the use is probably limited as it is hard to stabilize the rope.
(rope is invented by Rampa and I have added a special hook).



To spare explanation I have attached the project
By Rampa - 4 Years Ago
Awesome! Smile

I will obviously need to copy your locking mechanism. It works much better than mine did.
By Lord Ashes - 4 Years Ago
Rampa (1/19/2020)
I also did something like that where I locked one end of the cable. The upper ends of the cable are enlarged to lock into a receiver. They do break away pretty easily though!


This looks very much like what I need. So the part of the cable at the head is just pinned with softcloth black and the other end is designed to go around (lock) around a separate object which can then be animated? 

By Lord Ashes - 4 Years Ago
4u2ges (1/19/2020)
To spare explanation I have attached the project


Thank you very much. While Rampa provided a solution a project example is worth a thousand words. Thank-you for your project example.

By Lord Ashes - 4 Years Ago
4u2ges (1/19/2020)
To spare explanation I have attached the project


This is a great solution but I have a few comments and/or questions...
1. I see that you added an object for the rope (tube) driver. I think this was my issue when I tried it myself. I was attaching the rope (tube) directly to the winch for animation and, now, I realize that can't work because it will trigger an immediate collision. Having the driver, as in your project, seems to resolve that issue.
2. I noticed that you have a Winch object and a Winch Rigid object. It appears that the first is used for the visualization mesh while the second is being used for the physics. What was the reason behind this? Why could you not just activate the physics on the Winch itself? Was this to reduce the complexity of the mesh for physics in case the winch mesh is complicated?
3. What was the reason for using multiple locking objects as opposed to one O-ring? Was this to avoid having to use the Self Mesh on the lock objects (because Self Mesh is computation expensive compared to spheres)?

By Lord Ashes - 4 Years Ago
I'm trying to reproduce similar effects as those in Rampa\4u2ges solution.

Initially I made my own pipe and tries to make the lock using a single O-Ring. That did not seem to work so I tried using a number of spheres and that too did not work. However, when I put a simple box in the way (to prove that collision is being calculated) it did work. The enclosed project shows 4u2ges tube (I swapped his for mine to eliminate the possibility that mine was defective) with a oversize O-Ring. Initially I was trying this as an alternative to the lock that 4u2ges used (which used multiple objects) but when the tube seem to go right through it, I oversized it and had the tube fall on it to see if I am getting any collision what-so-ever. As can be seen, the oversized O-Ring seems to cause the tube some resistance but eventually the tube passes right through it. However, I also added a sphere inside the O-Ring that drops on to the bottom part of the O-Ring. That collision works fine - the O-Ring is solid for the sphere and does not let it through. I checked and the Collision setting between Soft and Rigid is set to 0.01 which should be a nice tight collision.

I have compared the working 4u2ges sample project and the settings in this project but I don't see any reason why the soft cloth is passing through the rigid object.

I can't seem to attach the project (I get an error saying I have exceeded some limit) so here is a link to the project from G Drive:

https://drive.google.com/open?id=1QL5bMC5dPZFm-dJaSuHWUxOrC0em5xjd   

By 4u2ges - 4 Years Ago
The answer is actually simple. Rigid Self-mesh body and soft cloth do not interact well to say the least. Solving this problem by RL would greatly contribute to the Avatars collision shapes concept.
But I doubt it will ever happen as it seems to be an NVIDIA limitation. So we are limited to plain Box, Sphere and Capsule shaped to interact with cloth.

About the winch. I did initially rotate the rigid winch itself. But that ended up in addition rope instability. So I have added a fake rotating winch.


By illusionLAB - 4 Years Ago
Assuming the rope/cable is taught... why bother with physics at all?  The winch with a coil that reveals (morph) and a stiff rope that gets shorter (morph).
By Rampa - 4 Years Ago
One other important detail is that the solver frequency must be set high. The coiling rope is at 1200 to get suitable performance.
By Lord Ashes - 4 Years Ago
illusionLAB (1/19/2020)
Assuming the rope/cable is taught... why bother with physics at all?  The winch with a coil that reveals (morph) and a stiff rope that gets shorter (morph).

This was actually my first thought but the reason I am interested in a physics solution is that my implementation for this"winch" is a trebuchet (catapult) prop. That means the initial winding (to bring down the trebuchet arm) could be done this way but after the trebuchet arm is brought down it is locked in place (usually using a pin system) and the rope is unwound so that it can be disconnected from the winch. This prevents the winch from having to unwind the rope when the trebuchet is fired (which would reduce the firing velocity). Thus if I find a physics solution, when I unwind the rope, I should get slack rope on the ground without having to fake it. But I do appreciate the suggestion. 

By Lord Ashes - 4 Years Ago
Rampa (1/19/2020)
One other important detail is that the solver frequency must be set high. The coiling rope is at 1200 to get suitable performance.

Thanks. I was able to reproduce the winch part of the sample project but it only worked with one type of material (out of the preset materials). I'm guessing that if I adjust the solver it may work with more.

By Lord Ashes - 4 Years Ago
Thanks. That answers both the question about the separate winch objects and about why the locking is made from multiple objects. On a side note I also learned something new about rotation today. When rotating multiple revolutions, I would typically put in a few keys going from 0 to 360 and then starting over. But in you sample project I see you just added one key at the end with a large rotation value and that implemented the multiple revolutions using just that one key. Good to know. Thanks. 
By Lord Ashes - 4 Years Ago
4u2ges (1/19/2020)
To spare explanation I have attached the project


If I may ask, what is the status of your tube and lock system that you showed in the sample project. I have some content that I am working on which I needed this for and while I eventually do want to make my own, I think it will take me some time. Are you okay with me using your version in some content or was this for educational purpose only and should not be re-used in any content? I'm willing to give you a copy of the content when it is done (its a trebuchet) and/or written thanks on the marketplace page (when the item is finished and uploaded to the market place). But if you do not wish me to use your version, I fully understand.

By 4u2ges - 4 Years Ago
I don't mind at all Lord Ashes. Feel free to use it in your projects and items.
The only thing is, that you'd probably be unable to texture it. For the best performance with physics weight map I did the *minimalist* UV unwrap (a straight line).
You can try to redo the UV unwrap and maybe you'd have a better luck with performance and stability.
By Lord Ashes - 4 Years Ago
4u2ges (1/21/2020)
I don't mind at all Lord Ashes. Feel free to use it in your projects and items.
The only thing is, that you'd probably be unable to texture it. For the best performance with physics weight map I did the *minimalist* UV unwrap (a straight line).
You can try to redo the UV unwrap and maybe you'd have a better luck with performance and stability.

Thanks. I'll pull it into Blender and see what I can do with the UV. In terms of performance, if I can achieve the motion that you had in the sample project, that would be perfect for my needs. I'll let you know how it goes.  

By Rampa - 4 Years Ago
A cylindrical unwrap, or unwrap following quads should work.

The double Bulge lock is really cool to stop motion in both directions. I found a way to more or less the same thing using just 4 blocks. Three around the cable and one as "cap" to stop back motion. The cable end is just the end edge loop widened at set at the same level as the previous edge loop. It's the sample frequency at 1200 that gives the holding power. Here is an exploded view of what I set up. I just put the top of the cable flush with the 3 blocks, and set the cap on top.
https://forum.reallusion.com/uploads/images/78cc3082-2ea7-4fad-ba72-9faf.jpg
I was hoping I could have a weight that the cable help up by physics, but no dice yet. Sad
By 4u2ges - 4 Years Ago
I found a way to more or less the same thing using just 4 blocks.


Cool, I'll check it out!
By Rampa - 4 Years Ago
An internal sphere works too! Smile

https://forum.reallusion.com/uploads/images/54f7d27b-907b-4ece-9c51-419a.jpg
By 4u2ges - 4 Years Ago
lol You finished it! This is a wonderful idea. Inner sphere lock is very strong!


Look here. It would not let go even if I added some extra rotations. The tube would stretch, even go inside the rigid winch, but lock is still holding. Absolute beauty!

https://forum.reallusion.com/uploads/images/2e5fb66c-5cfa-4a20-90f6-4d59.jpg




By Rampa - 4 Years Ago
Now we have a truly flexible cable that can be controlled from either end! 

That was a quick-and-dirty I did in CC3. Have to make a nicer one with both ends spherized in Blender. I think we could even hide the bulged faces using the mesh tools in CC3. I did try a non-bulged version, but it did not work well. The internal structure probably fowls that up, or it's just not enough contact. Maxing the friction of the cable and the sphere probably makes it even stronger.
By 4u2ges - 4 Years Ago
Yes, so the weight map could be potentially all white.
I was thinking of hiding ends with opacity map, as someone pointed recently that the mesh faces hidden in CC3 do not remain hidden, when the item is saved.
I tried it on a piece of cloth and indeed hidden faces were reverted once the cloth is saved and put back on an avatar. Is that a bug?
By Rampa - 4 Years Ago
The hidden faces not staying hidden would be a bug. Sad

So I'm thinking a skeleton within the cable might be a good addition as well. That way it can be posed into a position, the ball locks added, and then physics run. Both locks can be kinematic for animation.
By Rampa - 4 Years Ago
And here is a start. Smile


By Rampa - 4 Years Ago
Turns out all you need to do is put a cube inside the cable tube, and then give an offset of about 2 for the cloth physics. It locks itself in. The cube also locks the cable so you can pose the ends in different directions. I did close the ends of the tube, so it cannot slip out. A skeleton for initially posing the cable would make sense. Right now you can translate/rotate the two cubes to set new keys, as long as your first frame is at the original position.

Download the basic project and press play! Smile
https://drive.google.com/open?id=1DOv3JvkzkNGhLK9iUgeyOcnu4joaegY6
By 4u2ges - 4 Years Ago
The cube stopper is good too, bur I still prefer a sphere one you came up in the first place.
It seems to hold better...
By Lord Ashes - 4 Years Ago
I found the 4u2ges is good but, for me, it snapped out when the layout was not ideal. In my case, there is gravity at work (because it is hanging down) and the angle of the item it is attached to changes which requires corresponding compensation on the lock...so I could not get it to work properly.
I am currently experimenting with a needle style tube (i.e. a tube with a loop at the end). It can also be finicky if the correct physics settings are not used but so far it seems to be working for me. The "needle" tube is soft cloth and the "thread" that holds it is a V shape made from two boxes. A square outline made of 4 boxes could be used in stead of the two box V in cases where the whole thing needs to turn up side down but for my case, the two box V is sufficient.
Then I use simple opacity on the soft cloth to hide the loop portion.
Obviously the Trebuchet is still nowhere near done and the rope can use a bit of positioning and tightening but below shows a proof of concept for the rope loop implementation...

By 4u2ges - 4 Years Ago
That looks good Lord Ashes. I would not however disregard the ball hook Rampa came up with. It is strongest I've tested thus far and would not snap out easily, holding well when the rope is getting stretched while maintaining tension.
By Lord Ashes - 4 Years Ago
4u2ges (1/25/2020)
That looks good Lord Ashes. I would not however disregard the ball hook Rampa came up with. It is strongest I've tested thus far and would not snap out easily, holding well when the rope is getting stretched while maintaining tension.

Agreed. Rampa's lock is kind of a 3D version of my loop lock. I'll have to download his sample project to see how he gets the sphere ends to stay rigid. Even my loop loses its shape a bit when Soft Clothed.
Maybe the cube inside the locking makes the sphere ends retain their shape. I'll see when I study the sample project.

By Lord Ashes - 4 Years Ago
Now I have run into two issues with the next phase: the unwind.

1. The smaller issue is that during the unwind the rope on the winch slips and thus does not unwind as neatly as it winds. It also seem to generate odd jagged breaks. I think, however, if I play with the rope settings I may be able to minimize this problem.
2. I have created a tray under the winch (this tray is shown in white for now but will eventually be invisible). The tray is just made of boxes with Kinematic physics settings (although I also tried Static). The idea is to prevent the unwinding rope from going through the base of the Trebuchet and to gather at the back instead. However, no matter what I have tried the rope seems to go right through the tray. The soft cloth rope works with the winch (i.e. does not go through it) but refuses to work with the tray. The physics settings are Rigid, Kinematic (although I did try Static), Box, Collision Margin 0.8 (although I did try 0.1).


 
By Rampa - 4 Years Ago
I would delete the tray and insert a physics floor from the create menu, just to double-check myself. Size and place it correctly to stop the rope from falling.

The cubes do lock the rotation of the rope ends in all dimensions. So you can play with different shapes to completely lock one, or all, dimensions. A long capsule would lock only the length, for instance. The rope could still twist around the capsule. The cubes need to be a bit bigger than the spheres, so adjust to taste.
By Lord Ashes - 4 Years Ago
Rampa (1/25/2020)
I would delete the tray and insert a physics floor from the create menu, just to double-check myself. Size and place it correctly to stop the rope from falling.


Thanks. That did solve the issue of the collision (not sure what the difference between a physics enabled box and a physics plane is). It is also oddly called an infinite plane but looks finite to me. But I think I need to re-evaluate my approach because even with the collision plane being there, the rope unwinding doesn't look natural.

I was thinking of using your lock rope idea with extra connection points along the way to allow the rope to excess to be guided better...but eventually I would want the guides to disappear so that the rope slack can bend on it own. The issue is I am not sure how to do that. I am thinking that if the guides move a large distance between two consecutive frames, hopefully the physics engine will not try to follow. I'll do some testing and see. Thanks for the sample project.

By Lord Ashes - 4 Years Ago
Interesting...Rampa's cable does not have ballooned ends like I expected. It seems that the introduction of the driving boxes is what inflates the tube. Nice and elegant. Nice work.

I just did some tests and if the position of the guiding boxes is changed dramatically over two consecutive frames then the guide disengages. That makes it even better because it means you can guide part of the way and then disengage the guide to allow the rest of the motion to be by pure physics.
By Lord Ashes - 4 Years Ago
Found a solution to the unwinding problem which actually solved both problems. The two issues where that the rope was not unwinding in the direction that I wanted and it was slipping on the axle when unwinding. It turns out all I needed was a physics object that would push the slack rope in the direction that I wanted. Not only did that make the rope unwind towards the position that I wanted but also the pushing object kept the rope tight minimizing the slipping effect.
By Lord Ashes - 4 Years Ago
Rampa/4u2ges are you selling your lock based tube/rope/cable in your stores? A long time ago I was working on a flexible cable solution that would allow attaching a cable to two or more objects. At the time I constructed it using a bunch of small segments which were joined together by constraints. The segments where small enough so that they would not crash into each other but then they each had a larger non-physics shell which gave the illusion of a continuous tube. The solution worked but was very finicky. If the rope was stretched too long or moved too quickly the rope would break apart. However, on the off chance that someone wanted it, I put it into my Marketplace store. I didn't implement it as any actual prop, just a flexible cable. To my surprise it is one of the most purchased item in my store.

The one advantage of the cable that I originally created was that it could be attached to any number of objects anywhere along the length of the tube/rope. I think Rampa's locking mechanism is ingenious and so simple but it has the disadvantage that the guide (cube) causes the tube/rope to inflate. This is not a problem at the ends because opacity can be used to hide that but it becomes a problem if you want to place a guide (cube) somewhere along the way. For such cases I see a couple suggestions:

1. The guide along the way could be just a physics object which is not actually connected to the tube/rope but just pushes the tube/rope as desired. This is the technique that I used to address my trebuchet issue.
2. The tube/rope could be constructed with bubbles, along the length, attached to the length of the tube/rope. The guide (cubes) could then be placed in those bubbles instead of inside the main length of the rope so that the main length of the tube/rope is not inflated. The UV for the bubbles could be isolated so as to easily allow them to be hidden with opacity.

https://forum.reallusion.com/uploads/images/0c84b471-7248-4171-8ccf-70ff.png    
As I indicated in my previous post, a guide can be disconnected in real time by moving the guide a large distance between two consecutive frames. This would mean that any number of guides could be used to setup an initial shape but then the guides could be disconnected to allow the shape to flow naturally from that point.
By Rampa - 4 Years Ago
I had pretty much forgotten I had a store, from ages ago. I have no plans to put it in my store. You can take the idea and run with it! Smile
By 4u2ges - 4 Years Ago
@Lord Ashes
Quite frankly the idea of creating pockets might not be such a good for certain scenarios. There are many cases where the cable would need to be laid on the rigid ground.
In this case pockets might be counter-productive (even if not used) further destabilizing the cable/rope while coming in contact with the floor. Guides should be user-controlled IMO.
A simple capsule inside the rope with the diameter equals to the diameter of the cable (maybe a slightly larger), would not inflate the cable and at the same time could be an excellent helper guide for precision.

Here's something I am working with and I use the capsule to keep the near end high and parallel to the floor as I needed (this is simulated already).
It does hold well (for what I doing at least) with fairly low Drag number.


Without capsule guide

https://forum.reallusion.com/uploads/images/18dc8ac7-1c22-42ae-9a06-1a46.jpg

With capsule guide

https://forum.reallusion.com/uploads/images/80be3c14-4fff-4edd-b1c9-6278.jpg


The goal was to secure the cable inside the socket centered and prevent movements.

There should also be external guides to keep the cable from moving in certain directions.
So all this could be achieved on a user side with proper instructions.