Chain/Rope implementation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Chain/Rope implementation

Post by dweeb »

Hi All!

I'm working on a new game where you control a crane. From the crane there is a chain attached and under it a hook that can attach to objects.

I want the chain to be able to collide with other objects so it seems realistic. That pretty much rules out a single DistanceLimit as it cannot collide with objects.

Now I've started to make a chain with small boxes and RevoluteJoints (stole the idea from the bridge demo). As long as I make the hook in the end a bit heavier than the rest it seems to behave ok.

The issue is when I want to make the chain longer or shorter, then I need to remove or add items from the link of RevoluteJoints which is a bit tedious. Is there are better way to do it?

Any feedback is appreciated!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Chain/Rope implementation

Post by Norbo »

I've started to make a chain with small boxes and RevoluteJoints (stole the idea from the bridge demo)
It would probably work better with just BallSocketJoints instead. The RevoluteJoint has a RevoluteAngularJoint which fights any rotation around 2 of 3 degrees of angular freedom; it's like a hinge.
The issue is when I want to make the chain longer or shorter, then I need to remove or add items from the link of RevoluteJoints which is a bit tedious. Is there are better way to do it?
Not a particularly convenient way, no.

One possible option, assuming the minimum and maximum are limited, is to connect the entities with a bunch of DistanceLimits rather than BallSocketJoints. You could then reduce the maximum distance to reel it in, just like you could with a single DistanceLimit.

With any entity-based rope, though, you'll have to keep an eye out for instability and bad mass ratios. The individual rope pieces must be quite hefty in both mass and rotational inertia relative to the constraints and load to maintain stability.
dweeb
Posts: 14
Joined: Tue Jul 15, 2008 11:17 pm

Re: Chain/Rope implementation

Post by dweeb »

Thanks for the tips.

I went with the complicated method because I couldn't get it stable with the DistanceLimit for some reason.

Yes you really need to be careful about the balance and the chain/rope gets kind of heavy.

But I'm kind of happy with the result. Now I need to get the darn game done in March ;)
Post Reply