soft body and linear/angular constrain to two dimensional

dlx
Posts: 7
Joined: Fri Aug 03, 2012 8:39 pm

soft body and linear/angular constrain to two dimensional

Post by dlx »

Hi....

I'm new to bullet physics and have worked with rigid bodies until now. I came to work with soft bodies this week and still have some points to clarify - concerning my use cases.
The point I need some understanding for this thread is about linear/angular constrain to tow dimensional movements. For rigid bodies I know there's setLinearFactor() and setAngularFactor() functions which do the job.

The question is, is there a way I can achieve the same thing for soft bodies? As far as I could understand, with a soft body forces, impulses, collisions and so on are handled by body's node, would that be a limitation to constrain entire body's movements? Is there any alternative to do so?

Thanks,

PS: This is my first post/question in the bullets forum so be kind to me :D
Xcoder79
Posts: 42
Joined: Sun Aug 07, 2011 5:27 am

Re: soft body and linear/angular constrain to two dimensiona

Post by Xcoder79 »

To constrain two softbodies toghether


btSoftBody::LJoint::Specs ls;
ls.cfm = 1;
ls.erp = 1;
ls.position = btVector3(0, 0, 0);
BodyA->appendLinearJoint(ls,BodyB);



btSoftBody::AJoint::Specs aspecs;
aspecs.cfm = 1;
aspecs.erp = 1;
aspecs.axis = btVector3(0,0,0);

BodyA->appendAngularJoint(aspecs,BodyB);


Hope this helps you
dlx
Posts: 7
Joined: Fri Aug 03, 2012 8:39 pm

Re: soft body and linear/angular constrain to two dimensiona

Post by dlx »

Hi Xcoder79,

I'm not sure how a two soft bodies joint can help me to limit linear and angular movements but I'm giving it a try.

I'm also trying to cluster a soft and a rigid body(despite I'm still not sure what a cluster means in physics simulation context, I just saw somewhere in the forum it's possible).

Thanks a lot.
dlx
Posts: 7
Joined: Fri Aug 03, 2012 8:39 pm

Re: soft body and linear/angular constrain to two dimensiona

Post by dlx »

Hi Xcoder79,

Your tip helped me to solve my issues. Actually I added a rigid body to my simulation and added it to the linear joint. Limited the linear moving on the rigid body side - with rigidBody->setLinearFactor(1, 1, 0). I didn't need to add the rigid body to the angular joint since it has already done the trick with aspecs.axis = btVector3(0,0,1); as you suggested. As a final step I have anchored some soft body's nodes to the rigid one - with softBody->appendAnchor(i, rigidBody);

Any way, is that(joining rigid and soft bodies) what people say to be body clustering?

Thanks a lot for your help.