cloth vs btSphereShape Collision problem...

nagne83
Posts: 1
Joined: Mon Jul 25, 2011 4:55 am

cloth vs btSphereShape Collision problem...

Post by nagne83 »

I make goalpost. however... Not to Collision

Please please look at the attached video.

(sorry, Do not speak English well.)

/* softbody attribute */
psb->getCollisionShape()->setMargin(0.05);
btSoftBody::Material* pm=psb->appendMaterial();
pm->m_kLST = 0.1;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
psb->generateBendingConstraints(2,pm);
psb->m_materials[0]->m_kLST = 1.0;
psb->setTotalMass(100);
pdemo->getSoftDynamicsWorld()->addSoftBody(psb);

/* shoot Shape */ <-- this basic shootBoxShape
m_shootBoxShape = new btSphereShape(2);
btRigidBody* body = this->localCreateRigidBody(mass, startTransform,m_shootBoxShape);
body->setLinearFactor(btVector3(1,1,1));

btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
linVel.normalize();
linVel*=(m_ShootBoxInitialSpeed*2);

body->getWorldTransform().setOrigin(camPos);
body->getWorldTransform().setRotation(btQuaternion(0,0,0,1));
body->setLinearVelocity(linVel);
body->setAngularVelocity(btVector3(0,0,0));
body->setCcdMotionThreshold(0.5);
body->setCcdSweptSphereRadius(0.9f);
You do not have the required permissions to view the files attached to this post.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: cloth vs btSphereShape Collision problem...

Post by dphil »

It's a little hard to tell in the video, but it *looks* like there is a slight reaction from the cloth when the sphere passes through, which would mean it is detecting the collision, but some parameters need to be adjusted. Could you test a bit more and confirm visually that there is at least *some* collision detection/response going on (for example, try to place the sphere on the cloth gently, with a low velocity)? Assuming there is, here's a couple things to try to prevent the sphere passing through:

psb->m_cfg.kCHR = 1;

and after
psb->m_materials[0]->m_kLST = 1.0;

call
psb->updateConstants(); // I'm not too sure about this, but worth a shot just in case