Physics Theory Check: Ropes.

acron^
Posts: 6
Joined: Fri Jan 16, 2009 10:08 am

Physics Theory Check: Ropes.

Post by acron^ »

Hi guys,

Firstly, apologies for my lack of Physics aptitude. I am, admittedly, a little out of my depth, which is why I hope to use Bullet to solve a problem I've been tasked to overcome.

I haven't begun coding this yet, as I want to understand the best (or most straightforward) method before implementing something horrendous. The task is to implement a rope which, when released from a height and lowered toward a platform, coils in a pile -- as you'd expect a rope to do! Oh, and the platform is going to move and pivot.

The demo binaries show some nice examples of ropes I've scoured the SDK for rope stuff and found a reference to them in 'soft body' code. So, here are a few questions before I proceed:

static btSoftBody* CreateRope( btSoftBodyWorldInfo& worldInfo,
const btVector3& from,
const btVector3& to,
int res,
int fixeds);

- Can I use this function to achieve what I want? Do both ends need to be attached or can a rope not just dangle?
- Can I attach rigid bodies to this rope?
- Is it possible to get the position of a point along the rope?

Finally, does anyone have any further examples or example code of simple rope stuff that I can tinker with?

I really appreciate the help. I am keen to learn this. Thanks,

Ant
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Physics Theory Check: Ropes.

Post by Erwin Coumans »

acron^ wrote:The task is to implement a rope which, when released from a height and lowered toward a platform, coils in a pile -- as you'd expect a rope to do! Oh, and the platform is going to move and pivot.
- Can I use this function to achieve what I want? Do both ends need to be attached or can a rope not just dangle?
Rope, cloth and softbodies don't perform self-collision currently, so the rope would not coil in a pile properly.
- Can I attach rigid bodies to this rope?
Yes, you can attach rigid bodies to the rope, but in that case it is better to simply create a chain of rigid bodies with a rigid body constraint (btPoint2PointConstraint or other), instead of using a rope.
- Is it possible to get the position of a point along the rope?
Although it is not exactly clear what you mean by this, there is probably no such query available.
Hope this helps,
Erwin
acron^
Posts: 6
Joined: Fri Jan 16, 2009 10:08 am

Re: Physics Theory Check: Ropes.

Post by acron^ »

Thanks Erwin,

Your response makes a lot of sense, and after a few days of tinkering I now understand Bullet a bit better too.

Following on then, I thought about creating, as you suggest, a chain of objects. I have started using softbody objects rather than rigid though and I have a few more questions related to these.

- Can I attach two softbodies at a point? I found anchors but that only seems to apply to softbody-to-rigidbod. Perhaps contraints?
- Given my original task, would there be any significant benefit to using softbodies over rigidbodies? I went with softbodyies because they compress, thus making it a little more realistic.
- I've seen the many parameters that soft bodies have and I don't really understand them all. Which would be best to allow the softbodies to deform (to a certain point) and -not- spring back to their shape.

That last question about 'points along a rope' was a bit vague. I meant is it possible to get a point along it as if it were a spline. I intend to wrap a trimesh around the "rope", so I'm using the physics to generate a bezier curve.

Thanks again for your help and guidance.

Ant

EDIT: I've discovered socket joints (LJoint) - is there a way to add 'stiffness' to the joint? At the moment, the first body hits the floor and as it falls over the socket joint pivots the next body in the opposite direction and this continues up the rope, resulting in a zig-zag effect. Ideally, as a body rotates it should pull the adjacent body with it. Any ideas?

EDIT #2: Second to this, does Bullet natively support springs? I think some springs acting as joints would do nicely, but I can't find any mention of them on the forum.
acron^
Posts: 6
Joined: Fri Jan 16, 2009 10:08 am

Re: Physics Theory Check: Ropes.

Post by acron^ »

Shameless bump.