Best way to handle rope-rope collisions?

richiek_AL
Posts: 3
Joined: Mon Feb 22, 2010 4:35 am

Best way to handle rope-rope collisions?

Post by richiek_AL »

Hello all,

I'm trying to get rope-rope collision working so that examples like Init_RopesAttach in the SoftDemo source would have the ropes twisting around each other if the rigid body spins parallel to the plane. But no matter what I seem to do I can't get the ropes to collide with each other.

So... what's the best way to handle rope-rope collisions? Are they even supported?


Many thanks in advance.
Richard.
richiek_AL
Posts: 3
Joined: Mon Feb 22, 2010 4:35 am

Re: Best way to handle rope-rope collisions?

Post by richiek_AL »

Should I be assuming that it isn't possible to do rope-rope collisions?
If anyone knows anything your help would be greatly appreciated.

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

Re: Best way to handle rope-rope collisions?

Post by Erwin Coumans »

There is no collision between line segments of the rope / btSoftBody structures.

Have you considered to attach rigid bodies (with a btCapsuleShape) to the rope? That should give you rope-rope collisions. If the capsules needs to be very thin, you can try using a smaller timestep.

Thanks,
Erwin
richiek_AL
Posts: 3
Joined: Mon Feb 22, 2010 4:35 am

Re: Best way to handle rope-rope collisions?

Post by richiek_AL »

Thanks for the reply and the suggestion. Having capsules anchored along the links seems to work, and I also tried using spheres at the joints which worked too.

Now it's time to start tweaking parameters.... there are so many!! :wink:


Many thanks once again,
Richard.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Best way to handle rope-rope collisions?

Post by Flix »

richiek_AL wrote:Thanks for the reply and the suggestion. Having capsules anchored along the links seems to work, and I also tried using spheres at the joints which worked too.
I believe that the best way is to reuse the same capsule shape in such a way that the "spheres" inside the capsules overlap (of course constraint collisions between adiacent rope pieces must be disabled). This way the rope collision model is more robust in my opinion.
User avatar
Garibalde
Posts: 44
Joined: Fri Dec 18, 2009 6:06 pm
Location: Montreal

Re: Best way to handle rope-rope collisions?

Post by Garibalde »

Hi

I am trying the samething to create a rigid body rope. I am confused on how to fix one end of a rigid body. Is the case of softbodes you set the nodal mass to zero.. In rigid body how to you achieve the same result. Also i am looking for a quick example how to use btpoint2pointconstraint with capsules as suggested here.

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

Re: Best way to handle rope-rope collisions?

Post by Erwin Coumans »

You can use a constraint to lock the btRigidBody to the world, for example a btPoint2PointConstraint.

Code: Select all

btRigidBody* body = ...
btVector3 pivotInA(0,-1,0);
btTypedConstraint* p2p = btPoint2PointConstraint(*body,pivotInA);
world->addConstraint(p2p);
You can modify the pivot (in local space of A) to match the place where you want to fix the object.
Thanks,
Erwin
User avatar
Garibalde
Posts: 44
Joined: Fri Dec 18, 2009 6:06 pm
Location: Montreal

Re: Best way to handle rope-rope collisions?

Post by Garibalde »

Thanks worked perfectly.

I want to now place sphere objects between the capsules as suggested above.. I need to disable collision between adjacent objects. How do i disable collision check between specific objects?

For example i have a series of objects A, B and C

I want B not to collide with A and C, But everything else, I also want A and C to collide together.

Thanks
Garibalde
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Best way to handle rope-rope collisions?

Post by Flix »

Garibalde wrote:For example i have a series of objects A, B and C
I want B not to collide with A and C, But everything else, I also want A and C to collide together.
Well, for 3 objects I think you have to use collision flags manually (*).

Anyway I don't understand what kind of rope you are making: why do you need sphere shapes? A single capsule shape should be enough to cover all the roughness of the edges of the rope chunks (you can make the spheres INSIDE the capsule rope chunks match perfectly by overlapping them in the correct way). Isn't this enough for your purpose?

(*) Actually the "avoid collisions in constraint" mechanism seems work like this:

Code: Select all

void	btDiscreteDynamicsWorld::addConstraint(btTypedConstraint* constraint,bool disableCollisionsBetweenLinkedBodies)
{
	m_constraints.push_back(constraint);
	if (disableCollisionsBetweenLinkedBodies)
	{
		constraint->getRigidBodyA().addConstraintRef(constraint);
		constraint->getRigidBodyB().addConstraintRef(constraint);
	}
}
So it seems that rigid bodies stores the constraints between the bodies they don't want to collide with. Maybe you can try to tweak this behavior to your advantage.
User avatar
Garibalde
Posts: 44
Joined: Fri Dec 18, 2009 6:06 pm
Location: Montreal

Re: Best way to handle rope-rope collisions?

Post by Garibalde »

Thanks Flix. I see what you mean. you embed the spherical parts of the bodies within each other and disable
collision between the bodies.. that way there is no gap between the two bodies.. I was thinking as above to
the connection point between the two bodies at the top of the spherical surface.. i was then going to add an
addition sphere centered on that point to close the gap.

However i have come across another problem here. I got the chain of bodies working it creates a rope.. however at run time when i collied with it with a cylinder. it at time passes through the rope.. it seems that the individual elements of the rope (rigid bodies) seem to seperate when jerked around.. (the constraint is loose however springs back) Is there a way to tighten the constraint between the bodies? so that they do not drift part causing gaps?

Thanks.