Rope Joint 2D

Hi Guys,

I’ve tried many attempts to incorporate ropes into my game, first I started with a Spring Joint 2D and my rope looked ok but the rotation on the child objects was not following the rotation on the parents. I then tried a Hinge Joint 2D and got even worst effects. I know Box2D provides a Rope Joint out of the box and I’m not sure why Unity didn’t incorporated into their new 2D tools.

The best effect I got was by using the 3D Hinge Joint and providing a Motor to it, I’m not sure why the 3D works but the 2D component doesn’t?

Have you guys done anything like this with the new 2D Toolset?

Thanks
Dilmer

Currently the DistanceJoint has a bug in it that causes it to act like a RopeJoint. It should be the only joint you need to make a rope. Once they fix the bug, they will allow you to toggle the DistanceJoint to act like a RopeJoint or a WeldJoint.

Would they ever have this functionality available? do you know of any way of bringing Box2D framework functionality myself into Unity?

I’m saying that right now the DistanceJoint2D is acting like a RopeJoint, so you’re in luck, you can start using it now!
As for other box2d functionality, there is a plugin in the asset store that provides it.

Hi Kurius, that sounds great! Maybe you know a way to make the DistanceJoint behave like spring as well? I’m looking for a 2D joint that behaves like a spring, but has no minimum distance. In other words a spring that doesn’t ‘push’ but only ‘pulls’.

You can apply more than one kind of joint to the same object :wink:

Hmmm… don’t really see the solution here :slight_smile:
The problem is that the SpringJoint2D is in fact doing too much. It’s also generating force when the two attached objects are too close to each other (instead of allowing that, which I prefer). And as far as I can see, in unity that is the only 2D joint that has ‘springy’ proprties like Frequency and Damping.

Tell me more about what you are trying to achieve. … perhaps we can think of a different approach.?

The SpringJoint2D pushes or pulls, based on distance. If you want it to only pull, check the distance (or, faster, the square of the distance) at every FixedUpdate and disable it while its within its push distance.

Kurius, Pyrian describes exactly what I’m trying to achieve. And thanks, Pyrian, that was exactly my alternative plan :slight_smile: But if there is a ‘proper’ way to achieve the same, I would prefer that. From my experience, messing about with physics usually leads to a lot of trouble :wink:

Edit: No, it doesn’t. Works great!

[quote=“KeeWeed, post:10, topic: 534042, username:KeeWeed”]
From my experience, messing about with physics usually leads to a lot of trouble :wink:
[/quote]In my experience, it’s mixing physics with non-physics that causes most of the problems. Well, a lot of the problems. Messing with the physics directly is pretty safe, in comparison.