# Best Approach to create a pulley system

Hello all.

Well I decided to tyr to implement a pulley system the hard way, and obviously the wrong way.

I put 2 masses and on top a rigidbody (cylinder), then I started adding pill bodies and attach each other with a fixed joint, this didn’t help because when I run the game the heaviest mass start going down but on the pulley (cylinder) the pills that are above just get stuck and do not rotate as expected to keep going down as the mass pull them. Suddenly the pass throughout the cylinder and go down with the mass but in a very funny way, all of them pointing somewhere else…

So … kinda that robe approach didn’t help.

I was looking for something on the forums and found out a Rope implementation, but I dunno how to make it work on my scenario… :S

Anyway I say that in that implementation they used a Character Joint, so I replaced my fixed joints but o success either.

Has somebody implemented a pulley system? Or can somebody give me an advise to guide me on the right direction?

thx

Gustavo

This is very difficult to do by simulating the physical action of the ropes. It is probably easier to use a configurable joint to connect the two pulley blocks and then reduce the length of its linear limit to simulate the effect of the rope being pulled up. You could then use a line renderer or other techniques to create the impression of ropes going between the blocks.

Andree. By rope I mean / chain with small links with a joint for each one to the previous one… So if I understood correctly, instead of using some of the joints I used, I use a configurable joint on the links and joint them together… Right?

An order of to do would be.

Create small GameOjects and draw for each one a line renderer between the extreme points of the object. (*)
link each segment with its neighbor (GameObject) using a configurable joint.
(**)
Then link the first and last segments with their respective masses.

(*)What kind of collider should I apply to each segment ? and just to be sure I understand the theory, each GameObject segment must have a Rigidbody component attached, right?

(**)I need to pass the at some point some of the segments over the game object that will acting like a pulley… and rotate them accordinlgy…

Thanks for the reply…

I will try to implement graphically some small pulley system and see how does it looks…

damn im stuck i have been trying for a couple of days now but no success in making the simulation.

as you see I have my 2 spheres there, and on the top of the box I put some cylinders that will be the pulleys.

So im trying to connect the 2 spheres, first using one cylinder as pulley and always when I click play the balls falls down .

any clue?

OK, I seem to have misunderstood what you were aiming for here. I thought you were simulating a pulley block where the pulley move as the rope tightens.

Creating a rope with lots of joints attached in sequence is often very difficult to get working smoothly since it is a tough job for the physics engine to simulate it. You should probably use configurable joints for the links as they will give you a few options to play with. I would suggest trying the joints’ projection modes to PositionOnly and also adding a small amount of linear motion. You can do this by setting one of X/Y/Z motion constraints to Limited and then allowing a bit of linear motion in the linear limit. The axis you choose will be the one that lies along the rope.

The overall result will be slightly less realistic because the rope can “compress” along its length, but this tends to improve the behaviour of the joints. If the joints can move slightly relative to each other then it is less likely that any one joint will be stretched beyond its limit and then fail in a strange way.

Hello andeee, thanks for the reply once again.

So if I create a prefab with a collider, and then add to both ends a configurable joint, then attach each joint to the prev one form the prev link… right? :S . , configure the links as you suggested

Construct the “rope” and attach on the end of the outer links the masses.

Am I in the right direction?

Thx for the reply…

Gustavo

Hi Gustav - Were you able to make any progress with pulleys in Unity?

Hello dp, no unfortunately no. Then a higher priority project came and I had to leave it. The last thing l rememebr was that I implemented in cocos2d and was working great, but I want to do it in unity.

but how joint two blocks using HingeJoint bw two blocks
i can joint two blocks but how to joint these as in a pully

please show me with a visualization of some kind