Is there some minimum length for the soft body created by "btSoftBodyHelpers::CreateRope"? If so, how can I modify this? See below for the context.
It seems like the rope can't get any shorter than a length of 1 or so. For example, if I call "btSoftBodyHelpers::CreateRope()" with vectors a distance of 10 apart, I can clearly see that the rope is longer than a rope created by with vectors a distance of 1 apart. But if I can't seem to make the rope any shorter than that. No matter how small the distance between the vectors are, the rope always remains the same length as if I used vectors a distance of 1 apart.
Thanks
Minimum length of "btSoftBodyHelpers::CreateRope"?
-
- Posts: 3
- Joined: Mon Mar 30, 2015 9:57 pm
-
- Posts: 42
- Joined: Sun Aug 07, 2011 5:27 am
Re: Minimum length of "btSoftBodyHelpers::CreateRope"?
Have a look at bullet softbody demo
// Rope attach
//
static void Init_RopeAttach(SoftDemo* pdemo)
{
//TRACEDEMO
pdemo->m_softBodyWorldInfo.m_sparsesdf.RemoveReferences(0);
struct Functors
{
static btSoftBody* CtorRope(SoftDemo* pdemo,const btVector3& p)
{
btSoftBody* psb=btSoftBodyHelpers::CreateRope(pdemo->m_softBodyWorldInfo,p,p+btVector3(5,0,0),8,1);
psb->setTotalMass(50);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
return(psb);
}
};
btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin(btVector3(12,8,0));
// btRigidBody* body=pdemo->localCreateRigidBody(50,startTransform,new btBoxShape(btVector3(2,6,2)));
btSoftBody* psb0=Functors::CtorRope(pdemo,btVector3(0,8,-1));
btSoftBody* psb1=Functors::CtorRope(pdemo,btVector3(0,8,+1));
// psb0->appendAnchor(psb0->m_nodes.size()-1,body);
// psb1->appendAnchor(psb1->m_nodes.size()-1,body);
}
if you change p,p+btVector3(5,0,0),8,1); to any other value one can achive ropes of all diffrent sizes.
// Rope attach
//
static void Init_RopeAttach(SoftDemo* pdemo)
{
//TRACEDEMO
pdemo->m_softBodyWorldInfo.m_sparsesdf.RemoveReferences(0);
struct Functors
{
static btSoftBody* CtorRope(SoftDemo* pdemo,const btVector3& p)
{
btSoftBody* psb=btSoftBodyHelpers::CreateRope(pdemo->m_softBodyWorldInfo,p,p+btVector3(5,0,0),8,1);
psb->setTotalMass(50);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);
return(psb);
}
};
btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin(btVector3(12,8,0));
// btRigidBody* body=pdemo->localCreateRigidBody(50,startTransform,new btBoxShape(btVector3(2,6,2)));
btSoftBody* psb0=Functors::CtorRope(pdemo,btVector3(0,8,-1));
btSoftBody* psb1=Functors::CtorRope(pdemo,btVector3(0,8,+1));
// psb0->appendAnchor(psb0->m_nodes.size()-1,body);
// psb1->appendAnchor(psb1->m_nodes.size()-1,body);
}
if you change p,p+btVector3(5,0,0),8,1); to any other value one can achive ropes of all diffrent sizes.
-
- Posts: 3
- Joined: Mon Mar 30, 2015 9:57 pm
Re: Minimum length of "btSoftBodyHelpers::CreateRope"?
Thanks for the reply. That demo is actually the one I'm currently testing with. And it is the one where I see the problem.
If you set the delta btVector to a small offset, the rope will still stay relatively long. For an extreme example, if you try to set the offset btVector3 to something like btVector3(0.00001f, 0, 0), you would expect the rope to be extremely small. But what you actually end up getting is a rope that is still about the same length as if you used btVector3(1, 0, 0).
Thanks
If you set the delta btVector to a small offset, the rope will still stay relatively long. For an extreme example, if you try to set the offset btVector3 to something like btVector3(0.00001f, 0, 0), you would expect the rope to be extremely small. But what you actually end up getting is a rope that is still about the same length as if you used btVector3(1, 0, 0).
Thanks
-
- Posts: 3
- Joined: Mon Mar 30, 2015 9:57 pm
Re: Minimum length of "btSoftBodyHelpers::CreateRope"?
Below is an example that demonstrates the problem.
You do not have the required permissions to view the files attached to this post.