Soccer net and ball emulation problems

Post Reply
touchtao
Posts: 1
Joined: Tue Nov 24, 2020 9:56 pm

Soccer net and ball emulation problems

Post by touchtao »

Hi:
I'm writing a soccer game use bullet now. But when write the goal net, I met some strange problem, Hope somebody can help me.
1. I use btMultiBody to simulate the ball, not btRigidBody, because I need use rolling friction. btRigidBody with rolling friction will not roll in straight line on a plane. Ball mass : 0.265, Ball radius : (0.221/2.0);
2. I make a test goal net for 2 meter X 2 meter, resolution 5 X 5, four corner fixed. code below:

const btScalar s=2;
m_ActorBaseInfo.pSoftBody = btSoftBodyHelpers::CreatePatch( *m_pGameParam->pSoftBodyWorldInfo,
btVector3(-s,2,+s),
btVector3(+s,2,+s),
btVector3(-s,2,-s),
btVector3(+s,2,-s),
5,5,//9,9,//31,31,
1+2+4+8,
true);
btSoftBody::Material* pm=m_ActorBaseInfo.pSoftBody->appendMaterial();
pm->m_kLST = 0.1;
pm->m_kAST = 0.1;
pm->m_kVST = 0.1;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
m_ActorBaseInfo.pSoftBody->m_cfg.kDP = 0.2;
m_ActorBaseInfo.pSoftBody->m_cfg.kDF = 1;
m_ActorBaseInfo.pSoftBody->m_cfg.kSRHR_CL = 1;
m_ActorBaseInfo.pSoftBody->m_cfg.kSR_SPLT_CL = 0;
m_ActorBaseInfo.pSoftBody->m_cfg.collisions = btSoftBody::fCollision::CL_SS+btSoftBody::fCollision::CL_RS;
m_ActorBaseInfo.pSoftBody->generateBendingConstraints(2,pm);

m_ActorBaseInfo.pSoftBody->getCollisionShape()->setMargin(0.05);
m_ActorBaseInfo.pSoftBody->setTotalMass(1);
m_ActorBaseInfo.pSoftBody->setSpringStiffness(0.1);

m_ActorBaseInfo.pSoftBody->generateClusters(0);
m_pGameParam->pDynamicsWorld->addSoftBody(m_ActorBaseInfo.pSoftBody);

When I drop the ball above the net, the ball will not hold the ball, the ball will still fall on the ground. This is different with the result I use brRigidBody to simulate the ball. If I use the btRigidBody to simulate the ball , the goal net will hold the ball. Is something wrong with my code ?
3. When I use deformable-softbody to simulate the goal net, the net will hold the ball when ball fall above. But the FPS is very low, need too much CPU. So I just want to use the cluster softbody to simulate the net.

So the final question is : How to setup the softbody to simulate the goal net to hold the ball, with btMultiBody to simulate the ball, Cluster based softbody to simulate the net.
Please somebody to help me, thank you very much.
Attachments
goal net
goal net
goalnet.png (1008.45 KiB) Viewed 15836 times
Post Reply